Closed itachime closed 9 years ago
嗯,确实是在压缩后最后进行的替换,如果要避免,可以在压缩前的某一个插件扩展点上扩展一个插件,比如现在已经有同学这么干了;
fis.config.set('modules.parser.js', [function Replacer(content, file, conf) {
// some proc
return content.replace(/some-reg/ig, "some-string");
}]);
@xiangshouding 好,再问个问题,能否只针对某一个文件来替换呢,这样可能执行效率会高点
可以,从 file 里面拿到 filepath 看是否你想处理的文件,或者用 roadmap.path 给特定文件设置某个属性,插件处理的时候从 file 获取这个属性,如果是你想用来替换的文件就替换
在 2015年5月14日,上午10:07,heysb notifications@github.com 写道:
@xiangshouding 好,再问个问题,能否只针对某一个文件来替换呢,这样可能执行效率会高点
— Reply to this email directly or view it on GitHub.
@xiangshouding 好,试过可行,不过没有你说的 filepath
属性,而是 realpath
啵一个,不要在意这些细节,哈哈
在 2015年5月14日,上午10:51,heysb notifications@github.com 写道:
@xiangshouding 好,试过可行,不过没有你说的 filepath 属性,而是 realpath
— Reply to this email directly or view it on GitHub.
在
deploy
配置中设置了replace
来替换字符串,编译的时候加了o
参数,发现没有替换到,是因为压缩动作发现在布署之前么,替换字符串时在压缩过的文件中查找?如果是,如何避免,需要在压缩前替换字符串