您对以下方案的策略是什么:
我有:app / demo.less
我想:dist / demo.css
在我想要的中间:
使用regexp进行一些搜索/替换 自动添加供应商前缀 想要编译到更少对于每一步,都很容易定义源和目标。
但你怎么工作? 您是否为每个中间步骤创建一个文件并正确命名? 你是在第一步创建一个dist文件并在之后改变它吗?提前致谢。
What is your strategy for the following scenario:
I have: app/demo.less
I want: dist/demo.css
Inbetween I want:
do some search/replace using regexp add vendor-prefixes automatically want to compile to lessFor every single step it is easy to define source and destination.
But how do you work? Do you create a file for every intermediate step and name it properly? Do you create a file in dist in the first step and change inplace afterwards?Thanks in advance.
最满意答案
我会说2是最好的方法。 根据正则表达式的作用,您可能希望首先执行此操作,但我会说您将LESS处理为CSS,然后执行搜索和替换,然后自动添加您的供应商前缀。 生成中间文件没有任何意义,因为您之后很可能需要删除它们; 除非你这样做是为了调试目的。
您会发现这三项任务完全符合您的需求:
https://github.com/gruntjs/grunt-contrib-less https://github.com/nDmitry/grunt-autoprefixer https://github.com/erickrdch/grunt-string-replaceI'd say 2 is the best approach. Depending on what the regex is doing you may want to do this first, but I would say to process your LESS into CSS, then do search and replace, then add your vendor prefixes automatically. There's no real sense to generate intermediary files as you'll most likely need to remove them afterwards; unless you are doing so for debugging purposes.
You'll find that these three tasks do exactly what you need:
https://github.com/gruntjs/grunt-contrib-less https://github.com/nDmitry/grunt-autoprefixer https://github.com/erickrdch/grunt-string-replace更多推荐
发布评论