New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FAQ] 如何使用时间戳代替md5? #73

Open
hefangshi opened this Issue Jun 4, 2014 · 11 comments

Comments

Projects
None yet
8 participants
@hefangshi
Member

hefangshi commented Jun 4, 2014

可以在fis-conf.js中添加如下设置

已经设置过roadmap.path的项目不能重复set roadmap.path,否则roadmap.path设置会被覆盖,请在自己的roadmap.path的基础上进行query设置。

注意

roadmap.path配置后,所有的文件会按照roadmap.path数组的先后顺序对文件路径进行匹配,如果匹配成功,就会按照指定配置处理。

举例说明,如果还希望设置**.css的useSprite为true,则应该在/.*\.(js|css)$/ 的配置中添加useSprite: true,而不是在roadmap.path中添加一条**.css的配置。

关于roadmap.path更详细的说明可以参考 #76 以及文档roadmap.path

var now = new Date();
fis.config.set('timestamp', [now.getFullYear(), now.getMonth()+1, now.getDate(), now.getHours()].join(''));

fis.config.set('roadmap.path', [
    {
        reg: /.*\.(js|css)$/,
        query: '?t=${timestamp}',
        //useSprite: true
        useHash: false
    },
    {
        reg: '**.html',
        useCache: false
    }
]);

@hefangshi hefangshi added the faq label Jun 4, 2014

@littleshe

This comment has been minimized.

Show comment
Hide comment
@littleshe

littleshe Oct 30, 2014

有办法改用?t=md5吗?

littleshe commented Oct 30, 2014

有办法改用?t=md5吗?

@kxbrand

This comment has been minimized.

Show comment
Hide comment
@kxbrand

kxbrand Jan 6, 2015

同问,有办法用?t=md5吗

kxbrand commented Jan 6, 2015

同问,有办法用?t=md5吗

@hefangshi

This comment has been minimized.

Show comment
Hide comment
@hefangshi

hefangshi Jan 7, 2015

Member

目前没有,使用MD5做增量发布的好处还是比较多的,具体可以查看一些资料

#97

http://www.zhihu.com/question/20790576/answer/32602154

Member

hefangshi commented Jan 7, 2015

目前没有,使用MD5做增量发布的好处还是比较多的,具体可以查看一些资料

#97

http://www.zhihu.com/question/20790576/answer/32602154

@Htmldog

This comment has been minimized.

Show comment
Hide comment
@Htmldog

Htmldog Mar 11, 2015

用时间戳的话,是不是只能?t=xxx这种形式?不能像md5那样用时间戳来重命名文件?

Htmldog commented Mar 11, 2015

用时间戳的话,是不是只能?t=xxx这种形式?不能像md5那样用时间戳来重命名文件?

@avl169254

This comment has been minimized.

Show comment
Hide comment
@avl169254

avl169254 commented Apr 30, 2015

good

@Acer998

This comment has been minimized.

Show comment
Hide comment
@Acer998

Acer998 May 19, 2015

用时间戳的话,release后面的参数是什么?请教。

Acer998 commented May 19, 2015

用时间戳的话,release后面的参数是什么?请教。

@xiangshouding

This comment has been minimized.

Show comment
Hide comment
@xiangshouding
Contributor

xiangshouding commented May 19, 2015

@Acer998

This comment has been minimized.

Show comment
Hide comment
@Acer998

Acer998 May 19, 2015

@xiangshouding
文档中:
添加 --md5 [level] 或 -m [level] 参数
[level]指什么?刚接触fis,见笑。

Acer998 commented May 19, 2015

@xiangshouding
文档中:
添加 --md5 [level] 或 -m [level] 参数
[level]指什么?刚接触fis,见笑。

@Acer998

This comment has been minimized.

Show comment
Hide comment
@Acer998

Acer998 May 19, 2015

@xiangshouding
另外我发现用md5戳似乎不会重复生成文件,只要脚本内容没有改动,一直都是生成同一个md5戳,这个和另外一个问题中“md5戳会重复生成文件”好像不符合,是不是fis已经优化过这个问题呢?

Acer998 commented May 19, 2015

@xiangshouding
另外我发现用md5戳似乎不会重复生成文件,只要脚本内容没有改动,一直都是生成同一个md5戳,这个和另外一个问题中“md5戳会重复生成文件”好像不符合,是不是fis已经优化过这个问题呢?

@xiangshouding

This comment has been minimized.

Show comment
Hide comment
@xiangshouding

xiangshouding May 19, 2015

Contributor

@Acer998 内容不变,md5戳就是不会做变化的;

Contributor

xiangshouding commented May 19, 2015

@Acer998 内容不变,md5戳就是不会做变化的;

@chenyixuan

This comment has been minimized.

Show comment
Hide comment
@chenyixuan

chenyixuan Jul 7, 2015

@Acer998 可以了解一下md5的算法,是一种内容摘要算法,也就是根据内容而定结果,如果内容没变,md5戳也就不会变。

chenyixuan commented Jul 7, 2015

@Acer998 可以了解一下md5的算法,是一种内容摘要算法,也就是根据内容而定结果,如果内容没变,md5戳也就不会变。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment