welldone-software / gulp-durandal

Gulp plugin for building durandaljs projects
MIT License
13 stars 19 forks source link

added deepExclude, generateSourceMaps options. #13

Open spykedood opened 9 years ago

spykedood commented 9 years ago

Had to add deep exclude option (true by default). This is useful in a situation where the user may wish to ignore a folder of modules but keep any external dependencies those modules may have, such as jQuery or Knockout.

e.g.

gulp.task('durandal', function(){
    return durandal({
            baseDir: 'App',
            main: 'main.js',
            //output: 'main.js', //same as default, so not really required.
            deepExclude: false,
            generateSourceMaps: false,
            almond: false,
            minify: false,
            verbose: false,
            pluginMap: {
                '.html': 'text',
                '.json': 'text',
                '.txt': 'text'
            },
            moduleFilter: function(moduleName){
                var accept = true;

                if (moduleName.indexOf('apps/') == 0) accept = false;
                if (moduleName.indexOf('text!apps/') == 0) accept =  false;
                if (moduleName.indexOf('css!apps/') == 0) accept =  false;

                var action = accept ? "Accepted" :"Skipping";
                console.log(action + ": " + moduleName);
                return accept;
            }
        })
        .pipe(gulp.dest('path/to/build'));
});