Simplifying the "scripts" gulp task
This commit is contained in:
parent
445996744a
commit
c02fb6406b
22
gulpfile.js
22
gulpfile.js
@ -19,7 +19,7 @@ gulp.task('default', ['server', 'docs'], function() {
|
|||||||
config.globs.partials,
|
config.globs.partials,
|
||||||
config.globs.sass
|
config.globs.sass
|
||||||
]), ['markup']);
|
]), ['markup']);
|
||||||
gulp.watch(config.globs.js, ['browserify', 'docs']);
|
gulp.watch(config.globs.js, ['scripts', 'docs']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('docs', ['docs:files'], function() {
|
gulp.task('docs', ['docs:files'], function() {
|
||||||
@ -99,18 +99,24 @@ gulp.task('styles', function() {
|
|||||||
|
|
||||||
gulp.task('scripts', function() {
|
gulp.task('scripts', function() {
|
||||||
var browserify = require('browserify'),
|
var browserify = require('browserify'),
|
||||||
tap = require('gulp-tap');
|
source = require('vinyl-source-stream'),
|
||||||
|
buffer = require('vinyl-buffer'),
|
||||||
|
sourcemaps = require('gulp-sourcemaps'),
|
||||||
|
rename = require('gulp-rename');
|
||||||
|
|
||||||
return gulp.src('./src/js/main.js', { read: false })
|
var b = browserify(config.browserify)
|
||||||
.pipe(errorHandler())
|
|
||||||
.pipe(tap(function(file) {
|
|
||||||
var bundler = browserify(config.browserify)
|
|
||||||
.transform(require('./lib/canopy-transform'))
|
.transform(require('./lib/canopy-transform'))
|
||||||
.transform(require('babelify'))
|
.transform(require('babelify'))
|
||||||
.add(file.path);
|
.add('./src/js/main.js');
|
||||||
|
|
||||||
file.contents = bundler.bundle();
|
return b.bundle()
|
||||||
|
.pipe(source('./src/js/main.js'))
|
||||||
|
.pipe(buffer())
|
||||||
|
.pipe(sourcemaps.init({ loadMaps: true }))
|
||||||
|
.pipe(rename(function(path) {
|
||||||
|
path.dirname = '';
|
||||||
}))
|
}))
|
||||||
|
.pipe(sourcemaps.write('.'))
|
||||||
.pipe(gulp.dest(config.buildPath('js')));
|
.pipe(gulp.dest(config.buildPath('js')));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-sass": "^2.1.0",
|
"gulp-sass": "^2.1.0",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-tap": "^0.1.3",
|
|
||||||
"handlebars-layouts": "^3.1.2",
|
"handlebars-layouts": "^3.1.2",
|
||||||
"jasmine-core": "^2.3.4",
|
"jasmine-core": "^2.3.4",
|
||||||
"karma": "^0.13.14",
|
"karma": "^0.13.14",
|
||||||
@ -36,6 +35,8 @@
|
|||||||
"lodash": "^3.10.1",
|
"lodash": "^3.10.1",
|
||||||
"node-bourbon": "^4.2.3",
|
"node-bourbon": "^4.2.3",
|
||||||
"snapsvg": "^0.4.0",
|
"snapsvg": "^0.4.0",
|
||||||
"through": "^2.3.8"
|
"through": "^2.3.8",
|
||||||
|
"vinyl-buffer": "^1.0.0",
|
||||||
|
"vinyl-source-stream": "^1.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user