Last active
August 29, 2015 14:05
-
-
Save thomastuts/7c35d748e558c4936ff8 to your computer and use it in GitHub Desktop.
Adding files mid-stream in Gulp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path'); | |
var gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var templateCache = require('gulp-angular-templatecache'); | |
var addsrc = require('gulp-add-src'); | |
var paths = { | |
src: 'public/assets/src' | |
}; | |
var sourceFiles = [ | |
path.join(paths.src, 'app.js'), | |
path.join('!' + paths.src, 'templates.js'), | |
path.join(paths.src, 'routes.js'), | |
path.join(paths.src, '**/*module*.js'), | |
path.join(paths.src, '**/*.js') | |
]; | |
var templates = path.join(paths.src, '**/*.html'); | |
gulp.task('fox', function () { | |
return gulp.src(sourceFiles) | |
.pipe( | |
addsrc(templates) | |
.pipe(templateCache('templates.js', { | |
root: '/assets/src', | |
module: 'app.templates' | |
})) | |
) | |
.pipe(concat('bundle.js')) | |
.pipe(gulp.dest('dist')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment