如何设置Gruntfile忽略带下划线的文件?

时间:2016-08-24 13:39:31

标签: css gruntjs less

我的LESS文件夹中有几个文件,文件名前有下划线。例如:

_variables.less
_colors.less

这些文件只存储其他.less文件中使用的数据,因此不应生成.css文件。

有没有办法设置"忽略"在gruntfile.js这个档案上?

这是我目前的设置:

module.exports = function(grunt) {
    require('jit-grunt')(grunt);

    grunt.initConfig({
        uglify: {
            options: {
            manage: false
        },

        my_target: {
            files: [{
                expand: true,
                cwd: 'assets/js',
                src: '*.js',
                dest: 'assets/js/min' 
            }]
        },
    },
    less: {
        components: {
            options: {
                imports: {
                    reference: [
                        "assets/less/**/*.less",  
                    ]
                }   
            },

            files: [{
                expand: true,
                cwd: 'assets/less',
                src: [
                    'input.less'
                ],
                dest: 'assets/css/',
                ext: '.css'
            }]
        }
    },
    watch: {
        styles: {
            files: ['assets/less/**/*.less', 'assets/js/*.js'],
            tasks: ['less', 'newer:uglify'],
            options: {
                nospawn: truetasks
            }
        }
    }
});

grunt.loadNpmTasks('assemble-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-newer');
grunt.registerTask('default', ['less', 'watch', 'newer:uglify']);
};

0 个答案:

没有答案