Merge pull request #509 from suyash/mitmweb-add-sourcemap-generation

add sourcemap generation for scripts-app-dev task
This commit is contained in:
Maximilian Hils 2015-03-08 21:09:06 +01:00
commit ec4a6ec4e5
2 changed files with 18 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ var vendor_packages = _.difference(
// Custom linting reporter used for error notify // Custom linting reporter used for error notify
var jsHintErrorReporter = function(){ var jsHintErrorReporter = function(){
return map(function (file, cb) { return map(function (file, cb) {
if (file.jshint && !file.jshint.success) { if (file.jshint && !file.jshint.success) {
file.jshint.results.forEach(function (err) { file.jshint.results.forEach(function (err) {
@ -103,10 +103,10 @@ function styles_dev(files) {
} }
gulp.task("styles-app-dev", function(){ gulp.task("styles-app-dev", function(){
styles_dev(conf.css.app); styles_dev(conf.css.app);
}); });
gulp.task("styles-vendor-dev", function(){ gulp.task("styles-vendor-dev", function(){
styles_dev(conf.css.vendor); styles_dev(conf.css.vendor);
}); });
function styles_prod(files) { function styles_prod(files) {
@ -122,10 +122,10 @@ function styles_prod(files) {
} }
gulp.task("styles-app-prod", function(){ gulp.task("styles-app-prod", function(){
styles_prod(conf.css.app); styles_prod(conf.css.app);
}); });
gulp.task("styles-vendor-prod", function(){ gulp.task("styles-vendor-prod", function(){
styles_prod(conf.css.vendor); styles_prod(conf.css.vendor);
}); });
function vendor_stream(debug){ function vendor_stream(debug){
@ -153,28 +153,34 @@ gulp.task("scripts-vendor-prod", function(){
function app_stream(debug) { function app_stream(debug) {
var browserified = transform(function(filename) { var browserified = transform(function(filename) {
var b = browserify(filename, {debug: debug}) var b = browserify(filename, {debug: debug});
_.each(vendor_packages, function(v){ _.each(vendor_packages, function(v){
b.external(v); b.external(v);
}); });
b.transform(reactify); b.transform(reactify);
return b.bundle(); return b.bundle();
}); });
return gulp.src([conf.js.app]) return gulp.src([conf.js.app])
.pipe(dont_break_on_errors()) .pipe(dont_break_on_errors())
.pipe(browserified) .pipe(browserified)
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(rename("app.js")); .pipe(rename("app.js"));
}; }
gulp.task('scripts-app-dev', function () { gulp.task('scripts-app-dev', function () {
return app_stream(true) return app_stream(true)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(conf.static)) .pipe(gulp.dest(conf.static))
.pipe(livereload({ auto: false })); .pipe(livereload({ auto: false }));
}); });
gulp.task('scripts-app-prod', function () { gulp.task('scripts-app-prod', function () {
return app_stream(true) return app_stream(true)
.pipe(buffer()) .pipe(buffer())
.pipe(uglify()) .pipe(uglify())
.pipe(rev()) .pipe(rev())
.pipe(sourcemaps.write('./'))
.pipe(save_rev()) .pipe(save_rev())
.pipe(gulp.dest(conf.static)); .pipe(gulp.dest(conf.static));
}); });
@ -198,7 +204,7 @@ function templates(){
return gulp.src(conf.templates, {base:"src/"}) return gulp.src(conf.templates, {base:"src/"})
.pipe(replace(/\{\{\{(\S*)\}\}\}/g, function(match, p1) { .pipe(replace(/\{\{\{(\S*)\}\}\}/g, function(match, p1) {
return manifest[p1]; return manifest[p1];
})) }))
.pipe(gulp.dest(conf.dist)); .pipe(gulp.dest(conf.dist));
}; };
gulp.task('templates', templates); gulp.task('templates', templates);
@ -232,7 +238,7 @@ gulp.task(
templates templates
); );
gulp.task( gulp.task(
"prod", "prod",
[ [
"fonts", "fonts",
"copy", "copy",