Skip to content

Instantly share code, notes, and snippets.

@danielyogel
Created July 28, 2014 22:18
Show Gist options
  • Save danielyogel/132963317ed8ecf38b6a to your computer and use it in GitHub Desktop.
Save danielyogel/132963317ed8ecf38b6a to your computer and use it in GitHub Desktop.
gulp config
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require("gulp-rename"),
ngAnnotate = require('gulp-ng-annotate'),
sourcemaps = require('gulp-sourcemaps'),
livereload = require('gulp-livereload'),
templateCache = require('gulp-angular-templatecache'),
compass = require('gulp-compass');
gulp.task('templates', function () {
return gulp.src('js/**/*.html')
.pipe(templateCache({module: 'myApp', root: 'js/'}))
.pipe(gulp.dest('dist'));
});
gulp.task('js', function () {
return gulp.src(['js/main.js', 'js/**/*.js', 'dist/templates.js'])
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(gulp.dest('dist'))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('watch', ['templates', 'js'], function () {
livereload.listen();
gulp.watch('js/**/*.html', ['templates']);
gulp.watch(['js/**/*.js', 'dist/templates.js'], ['js']);
gulp.watch(['dist/**', 'js/**/*.html']).on('change', livereload.changed);
});
gulp.task('default', ['watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment