Created
September 21, 2016 08:00
-
-
Save tonkec/1cb8b2f0926d548a8060db05369f3934 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
BASIC GULPFILE FOR COMPILING SASS, MINIFYING CSS | |
AND RELOADING PAGE WITH BROWSERSYNC | |
*/ | |
var gulp = require('gulp'); | |
var Promise = require('es6-promise').Promise; | |
var sass = require('gulp-sass'); | |
var rename = require('gulp-rename'); | |
var minifyCss = require('gulp-minify-css'); | |
var browserSync = require('browser-sync'); | |
var reload = browserSync.reload; | |
var src = { | |
scss: 'sass/*.scss', | |
css: 'css', | |
html: '*.html' | |
}; | |
gulp.task('serve', ['sass'], function() { | |
browserSync.init({ | |
server: "./" | |
}); | |
gulp.watch(src.scss, ['sass']); | |
gulp.watch(src.scss).on('change', reload); | |
gulp.watch(src.html).on('change', reload); | |
}); | |
// Compile sass into CSS | |
gulp.task('sass', function() { | |
return gulp.src(src.scss) | |
.pipe(sass({ | |
includePaths: ['scss'], | |
onError: browserSync.notify | |
})) | |
.on('error', sass.logError) | |
.pipe(minifyCss({compatibility: 'ie8'})) | |
.pipe(rename("main.min.css")) | |
.pipe(gulp.dest(src.css)); | |
}); | |
gulp.task('default', ['serve']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment