1

I have a Grunt task that loops through directories and sub directories and compresses the JS and CSS files.

I get the following error which means that it accidentally thought less.js folder is a JavaScript file. I am wondering is it possible to configure that regular expression (wildcard) to skip directories that have name such as less.js.

enter image description here

module.exports = function(grunt) {
    grunt.initConfig({
        uglify: {
            options: {
                mangle: false
            },
            files: {
                expand: true,
                flatten: false,
                cwd: "script",
                src: ["**/*.js", "**/!*.min.js"],
                dest: "release/script",
                ext: ".js"
            }
        }, cssmin: {
            target: {
                files: [{
                    expand: true,
                    flatten: false,
                    cwd: "style",
                    src: ["**/*.css", "**/!*.min.css"],
                    dest: "release/style",
                    ext: ".css"
                }]
            }
        }
    });

    grunt.loadNpmTasks("grunt-contrib-cssmin");
    grunt.loadNpmTasks("grunt-contrib-uglify");

    grunt.registerTask("default", ["uglify", "cssmin"]);
};
somethinghere
  • 16,311
  • 2
  • 28
  • 42
Node.JS
  • 1,042
  • 6
  • 44
  • 114

1 Answers1

2

You could decide to ignore any folder that contains .js in the folder name by adding this rule to your files:

!*.js/
somethinghere
  • 16,311
  • 2
  • 28
  • 42