Skip to content

Instantly share code, notes, and snippets.

@iign
Last active November 14, 2016 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iign/76f32622bd9adbd62f2325044e555207 to your computer and use it in GitHub Desktop.
Save iign/76f32622bd9adbd62f2325044e555207 to your computer and use it in GitHub Desktop.
Basic Gulpfile
var gulp = require('gulp')
var sass = require('gulp-sass')
var autoprefixer = require('gulp-autoprefixer')
var browserSync = require('browser-sync').create()
gulp.task('sass', function () {
gulp.src('sass/**/main.scss')
.pipe(sass({outputStyle: 'uncompressed'}).on('error', sass.logError))
.pipe(autoprefixer('last 3 versions', '> 1%', 'ie 8'))
.pipe(gulp.dest('./css'))
})
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function () {
return gulp.src('sass/*.scss')
.pipe(sass())
.pipe(gulp.dest('css'))
.pipe(browserSync.stream())
})
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function () {
browserSync.init({
server: './'
})
gulp.watch('sass/*.scss', ['sass'])
gulp.watch('*.html').on('change', browserSync.reload)
})
gulp.task('default', ['serve'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment