gruntjsdurandal

How to exclude one folder in grunt-durandal


For example

durandal: {
main: {
    src: ['app/**/*.*', 'lib/durandal/**/*.js'],
    options: {
        name: '../lib/require/almond-custom',
        baseUrl: requireConfig.baseUrl,
        mainPath: 'app/main',
        paths: mixIn({}, requireConfig.paths, { 
            'almond': '../lib/require/almond-custom.js' 
        }),
        exclude: [],
        optimize: 'none',
        out: 'build/app/main.js'
    }
}}

My task is to exclude files in 'app/test/' folder. I tried to add 'app/test/**/**.*', but exception occurs says 'no such files or directory'.

So what is the correct way to do this?


Solution

  • The globbing patterns section of the grunt docs state:

    ! at the beginning of a pattern will negate the match

    Change the value of the src property in your durandal task to the following:

    src: ['app/**/*.*', '!app/test/**', 'lib/durandal/**/*.js'],
    

    Note the addition of '!app/test/**' in the array of globbing patterns.