gpt4 book ai didi

gruntjs - Grunt 将每个目录中的所有 .less 编译为 .css

转载 作者:行者123 更新时间:2023-12-04 02:22:58 24 4
gpt4 key购买 nike

所以我将我的网站设置为使用模块,其中每个模块都有自己的 .less 文件,需要将其编译成 .css。

文件夹结构:/common/modules/{module-name}/style.less

我需要将所有 style.less 文件转换为同一目录中的 style.css 文件。例如:

/common/modules/clock/style.less 需要编译成 /common/modules/clock/style.css

我不想将每个模块单独添加到我的 grunt 文件中,有没有办法动态地做到这一点?

最佳答案

另请参阅:http://gruntjs.com/configuring-tasks#globbing-patterns

您可以定义以下任务:

  grunt.initConfig({
less: {
compileCore: {
options: {
strictMath: true
},
files: [{
expand: true,
src: ['/common/modules/**/style.less'],
ext: '.css',
extDot: 'first'
}]
}
}
});

关于gruntjs - Grunt 将每个目录中的所有 .less 编译为 .css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26106254/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com