首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Grunt查看较少文件的目录

用Grunt查看较少文件的目录
EN

Stack Overflow用户
提问于 2015-09-11 13:56:53
回答 1查看 37关注 0票数 1

我现在的Grunt代码:

代码语言:javascript
复制
module.exports = function(grunt) {
    grunt.initConfig({
        // running `grunt less` will compile once
        less: {
            development: {
                options: {
                    paths: ["custom"],
                    yuicompress: true
                },
            files: {
                "custom/file1.css": "custom/*.less",
                "custom/file2.css": "custom/*.less"

            }
        }
    },
    // running `grunt watch` will watch for changes
    watch: {
        files: "custom/*.less",
        tasks: ["less"]
    }
});
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.registerTask('default', ['less:development']);

};

与其指定两个单独的文件"file1“和"file2",我更希望它编译和监视”自定义“中的所有.less文件。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-11 14:00:21

显然,您必须使用重命名回调:

代码语言:javascript
复制
files: [{
    src: ['custom/*.less'],
    expand: true,
    rename: function(dest, src) { return dest + src.replace('.less', '.css') },
    dest: ''
}]

来源:https://github.com/gruntjs/grunt-contrib-less/issues/135

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32525235

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档