Skip to content

Instantly share code, notes, and snippets.

@m0n01d
Created October 17, 2016 20:33
Show Gist options
  • Save m0n01d/43a4682f7bbbeb232f17b266056f940b to your computer and use it in GitHub Desktop.
Save m0n01d/43a4682f7bbbeb232f17b266056f940b to your computer and use it in GitHub Desktop.
const viewFiles = ['src/js/**/*.html', '!src/js/**/*.async.html'];
const asyncViewFiles = 'src/js/**/*.async.html';
gulp.task('asyncViews', function () {
return gulp.src(asyncViewFiles)
.pipe(gulp.dest('./build/templates'));
});
gulp.task('views', ['asyncViews'], function () {
return gulp.src(viewFiles)
.pipe(templateCache({
standalone: true,
}))
.on('error', interceptErrors)
.pipe(rename('app.templates.js'))
.pipe(gulp.dest('./src/js/config/'));
});
// inside my angular component
// if i want to load the view asynchronously
templateUrl: 'templates/providerTerms/providerTerms.async.html',
// otherwise
templateUrl: 'providerTerms/providerTerms.html',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment