Skip to content

Instantly share code, notes, and snippets.

@yangshun
Created August 11, 2016 13:00
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 yangshun/3ead2d96496f6a11757b6969cf7d4e50 to your computer and use it in GitHub Desktop.
Save yangshun/3ead2d96496f6a11757b6969cf7d4e50 to your computer and use it in GitHub Desktop.
Static web server with styles watching
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var webserver = require('gulp-webserver');
gulp.task('sass', function () {
return gulp.src('./sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'));
});
gulp.task('sass:watch', function () {
gulp.watch('./sass/**/*.scss', ['sass']);
});
gulp.task('serve', function() {
gulp.src('./')
.pipe(webserver({
livereload: true,
open: true
}));
});
gulp.task('default', ['sass', 'sass:watch', 'serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment