Skip to content

Instantly share code, notes, and snippets.

@joshualeduc
Last active April 12, 2016 18:09
Show Gist options
  • Select an option

  • Save joshualeduc/2bbe46029a1008e9a4d6d7bc77656aa9 to your computer and use it in GitHub Desktop.

Select an option

Save joshualeduc/2bbe46029a1008e9a4d6d7bc77656aa9 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify')
var uglifycss = require('gulp-uglifycss');
var ngAnnotate = require('gulp-ng-annotate');
var server = require('gulp-webserver');
var htmlmin = require('gulp-htmlmin');
var watcher = gulp.watch(['./src/js/**/*.js', './src/styles/*.scss', './src/views/**/**/*.html', './src/*.html'], ['default']);
watcher.on('change', function( event ) {
console.log('File ' + event.path + ' was ' + event.type + ' at ' + new Date() + ' , running tasks...');
});
gulp.task('styles', function(){
gulp.src('./src/styles/*.css')
.pipe(uglifyCss())
.pipe(concat('styles.css'))
.pipe(gulp.dest('./public/'));
});
gulp.task('javascript', function() {
gulp.src('./src/js/**/*.js')
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(concat('all.min.js'))
.pipe(gulp.dest('./public/app.min.js'))
});
gulp.task('html', function() {
gulp.src('./src/views/**/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./public/views'))
});
gulp.task('index', function() {
gulp.src('./src/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('./public'))
});
gulp.task('default', ['style', 'javascript', 'html', 'index']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment