Skip to content

Commit c16a692

Browse files
committed
chore(build): fixed multiple occurrences of 'use strict' statement
1 parent a78d21c commit c16a692

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

gulpfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ gulp.task('scripts', ['scripts:lint', 'scripts:cacheTpls', 'vendor:js'], functio
151151
var arr = (config.vendor_files.js).concat(config.paths.scripts.concat(config.build + '/app/templates.js'));
152152
return gulp.src(arr)
153153
.pipe(plugins.ngAnnotate())
154-
.pipe(plugins.concat(pkg.name + '-' + pkg.version + '.js'))
154+
.pipe(plugins.concatUtil(pkg.name + '-' + pkg.version + '.js', {
155+
process: function (src) {
156+
return (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1');
157+
}
158+
}))
159+
.pipe(plugins.concatUtil.header('\'use strict\';\n'))
155160
.pipe(plugins.size({ showFiles: true, title: '[JS]' }))
156161
.pipe(plugins.uglify({
157162
mangle: false,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"gulp-autoprefixer": "0.0.7",
1818
"gulp-bytediff": "^0.2.0",
1919
"gulp-concat": "^2.2.0",
20+
"gulp-concat-util": "^0.5.1",
2021
"gulp-filesize": "0.0.6",
2122
"gulp-html-replace": "^1.1.0",
2223
"gulp-imagemin": "^0.5.1",

0 commit comments

Comments
 (0)