有没有办法阻止grunt-contrib-less编译带有下划线的文件?
我有一组文件正在主文件中导入。导入的文件前缀为下划线@import "_fileone"
,但由于我使用动态映射的grunt,所有.less文件正在编译 - 而我只对主文件感兴趣。
答案 0 :(得分:0)
您可以创建第二个grunt任务,使用no compress,mangler等选项处理此下划线文件。
你也可以在两个任务中分离这个下划线和正常,并且最近看两个
答案 1 :(得分:0)
不确定这是否能回答你的问题,但是如果使用@import引用指令,那么从less.js 1.5开始,这些文件将无法编译,但它们的引用(mixins等)将可用于less文件中。< / p>
来自less.js文档:
**Import Options**
Less offers several extensions to the CSS @import CSS at-rule to provide more flexibility over what you can do with external files.
Syntax: @import (keyword) "filename";
The following import directives have been implemented:
reference: use a Less file but do not output it
inline: include the source file in the output but do not process it
less: treat the file as a Less file, no matter what the file extension
css: treat the file as a CSS file, no matter what the file extension
once: only include the file once (this is default behavior)
multiple: include the file multiple times
答案 2 :(得分:0)
在较少的任务中忽略以_
开头的文件src: ['styles/*.less', '!styles/_*.less'],
这是忽视的正常咕噜声,与LESS无关:)