Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grunt Concat Task, how to ignore all .min.js files?

I have the following grunt concat task. How can I make concat ignore all minified files? This doesn't work.

concat: {
    js: {
        src:  [ 
            '<%= globalConfig.bar %>', 
            '<%= globalConfig.foo %>/*.js', 
            '<%= globalConfig.foo %>/!*.min.js', 
            '<%= globalConfig.fooLib %>/*.js', 
            '<%= globalConfig.fooLib %>/!*.min.js'
        ],
        dest: '../../foo/fooCombined.js'
    },
    css: {
        src: ['<%= globalConfig.foo %>/*.css'],
        dest: '../../foo/fooCombined.css'
    }
},

This also doesn't work:

'<%= globalConfig.fooLib %>/(*.js && !*min.js)'

Any help is appreciated. Thanks.

like image 221
Kris Hollenbeck Avatar asked Dec 16 '13 23:12

Kris Hollenbeck


1 Answers

Try this:

concat: {
  js: {
    src:  [ 
        '<%= globalConfig.bar %>', 
        '<%= globalConfig.foo %>/*.js', 
        '<%= globalConfig.fooLib %>/*.js', 
        '!**/*.min.js'
    ],
    dest: '../../foo/fooCombined.js'
  },
  css: {
    src: ['<%= globalConfig.foo %>/*.css'],
    dest: '../../foo/fooCombined.css'
  }
},

Negate or ! is placed at the beginning of a valid pattern to produce the opposite effect. Patterns are processed in order, so placing a negated pattern that you wish to exclude at the end, will do the trick.

See http://gruntjs.com/configuring-tasks#globbing-patterns for more info.

like image 101
Kyle Robinson Young Avatar answered Oct 16 '22 15:10

Kyle Robinson Young