Skip to content

Instantly share code, notes, and snippets.

@iign iign/gulpfile.js
Last active Nov 14, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.