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

微笑、不失礼 提交于 2019-12-05 12:05:42

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/20622914/grunt-concat-task-how-to-ignore-all-min-js-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!