"gulp-angular-templatecache": "~1.8.0",
"gulp-batch": "~1.0.5",
"gulp-bytediff": "~1.0.0",
+ "gulp-content-to-variable": "~0.1.0",
"gulp-cssnano": "~2.1.2",
"gulp-filter": "~4.0.0",
"gulp-header": "~1.8.2",
"gulp-nodemon": "~2.0.7",
"gulp-order": "~1.1.1",
"gulp-print": "~2.0.1",
+ "gulp-rename": "~1.2.2",
"gulp-rev": "~7.0.0",
"gulp-rev-replace": "~0.4.3",
"gulp-task-listing": "~1.0.1",
jsFilesStubs: [
main + 'stubs/**/*.js'
],
+ jsFilesWorkers: [
+ main + 'workers/**/*.js'
+ ],
index: main + 'index.html',
jsHintConfigurationFile: $.path.join(__dirname, '.jshintrc'),
jscsConfigurationFile: $.path.join(__dirname, '.jscsrc'),
html: app + '**/*.html',
templateFile: 'templates.js',
+ workersFile: 'workers.js',
temp: './.tmp/',
*
* @returns {stream} The stream.
*/
- gulp.task('build', ['wireup', 'templatecache'], function() {
+ gulp.task('build', ['wireup', 'templatecache', 'workers'], function() {
log('*** Building application for production - Optimizing assets - HTML,CSS,JS ***');
var jsAppFilter = plugins.filter('**/app.min.js', {restore: true});
var jslibFilter = plugins.filter('**/lib.min.js', {restore: true});
var templateCache = config.temp + config.templateFile;
+ var workersFile = config.temp + config.workersFile;
return gulp.src(config.index)
// Inject templates
.pipe(inject(templateCache, 'templates'))
+ // Inject workers
+ .pipe(inject(workersFile, 'workers'))
+
// Gather all assets from the html with useref
.pipe(assets)
* @ngdoc function
*
* @description
+ * Inline workers and shared workers
+ *
+ * @returns {stream}
+ */
+ gulp.task('workers', function() {
+
+ log('*** Inline workers or shared workers ***');
+
+ return gulp
+ .src(config.jsFilesWorkers)
+ .pipe(plugins.contentToVariable({
+ variableName: 'workers',
+ asMap: true
+ }))
+ .pipe(plugins.rename(config.workersFile))
+ .pipe(gulp.dest(config.temp));;
+
+ });
+
+ /**
+ * @ngdoc function
+ *
+ * @description
* Inject files in a sorted sequence at a specified inject label.
*
* @param {Array|string} source Source files (glob patterns)