Skip to content

Instantly share code, notes, and snippets.

@vprasanth
Created September 25, 2015 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vprasanth/dc46369a4733d308c7d5 to your computer and use it in GitHub Desktop.
Save vprasanth/dc46369a4733d308c7d5 to your computer and use it in GitHub Desktop.
gulpfile
'use strict';
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var es = require('event-stream');
var del = require('del');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync');
var minifyHTML = require('gulp-minify-html');
var sass = require('gulp-sass');
var reload = browserSync.reload;
gulp.task('scripts', function () {
return gulp.src(['src/x1-pop-up-help.module.js', 'src/*.js'])
.pipe(sourcemaps.init())
.pipe(concat('x1help.min.js'))
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('minify-html', function () {
return gulp.src('src/*.html')
.pipe(minifyHTML())
.pipe(gulp.dest('dist'));
});
gulp.task('sass', function(){
return gulp.src('src/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('serve', function () {
browserSync({
server: {
baseDir: './'
},
open: false
});
gulp.watch('src/*.js', ['js-watch']);
gulp.watch('src/*.scss', ['sass-watch']);
gulp.watch('src/*.html', ['html-watch']);
gulp.watch('index.html', reload);
});
gulp.task('js-watch', ['scripts'], reload);
gulp.task('sass-watch', ['sass'], reload);
gulp.task('html-watch', ['minify-html'], reload);
gulp.task('build', ['scripts', 'minify-html', 'sass']);
gulp.task('default', ['scripts', 'minify-html', 'sass', 'serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment