Allows for minified and unminifed bower versions

This commit is contained in:
2016-02-23 18:26:39 +01:00
parent 924ea137b9
commit e98765fbdb

View File

@@ -2,7 +2,7 @@ var gulp = require('gulp');
var plugins = require('gulp-load-plugins')({}); var plugins = require('gulp-load-plugins')({});
var karma = require('karma'); var karma = require('karma');
var es = require('event-stream'); var es = require('event-stream');
var bowerFiles = require('main-bower-files'); var mainBowerFiles = require('main-bower-files');
var exists = require('path-exists').sync var exists = require('path-exists').sync
var pipes = {}; var pipes = {};
@@ -18,23 +18,30 @@ var paths = {
} }
pipes.vendorJsFiles = function() { var bowerFilesMinified = mainBowerFiles({
return gulp.src(bowerFiles({ overrides : {
overrides : { jquery : {
jquery : { main: []
main: [] },
}, bootstrap : {
bootstrap : { main: [ "dist/**/*.css" ]
main: [ "dist/**/*.css" ] }
} }
} }).map(function(path, index,arr) {
}).map(function(path, index,arr) { var newPath = path.replace(/.([^.]+)$/g, '.min.$1');
var newPath = path.replace(/.([^.]+)$/g, '.min.$1'); return exists ( newPath ) ? newPath : path;
console.log('path: ' + path + ' newpath:' + newPath + ' exits: ' + exists(newPath) ) })
return exists ( newPath ) ? newPath : path;
})) var bowerFiles = mainBowerFiles({
.pipe(plugins.debug({title: 'vendor-js:'})) overrides : {
} jquery : {
main: []
},
bootstrap : {
main: [ "dist/**/*.css" ]
}
}
})
pipes.validatedAppScripts = function() { pipes.validatedAppScripts = function() {
return gulp.src(paths.appFiles) return gulp.src(paths.appFiles)
@@ -55,7 +62,7 @@ pipes.validatedPages = function() {
} }
pipes.builtIndexDev = function() { pipes.builtIndexDev = function() {
var vendorFiles = pipes.vendorJsFiles() var vendorFiles = gulp.src(bowerFilesMinified)
.pipe(gulp.dest(paths.distDev + '/vendor')); .pipe(gulp.dest(paths.distDev + '/vendor'));
var appScript = pipes.validatedAppScripts() var appScript = pipes.validatedAppScripts()
.pipe(plugins.angularFilesort()) .pipe(plugins.angularFilesort())
@@ -91,6 +98,4 @@ gulp.task('test', function(done) {
}); });
gulp.task('build-dev', pipes.builtIndexDev); gulp.task('build-dev', pipes.builtIndexDev);