Skip to content

Instantly share code, notes, and snippets.

@hgoldstein95
Created August 17, 2015 18:50
Show Gist options
  • Save hgoldstein95/b037182ffdb543db86b3 to your computer and use it in GitHub Desktop.
Save hgoldstein95/b037182ffdb543db86b3 to your computer and use it in GitHub Desktop.
Standard Gulpfile for Sass and Jade
var gulp = require('gulp');
var sass = require('gulp-sass');
var jade = require('gulp-jade');
var browserSync = require('browser-sync').create();
var autoprefixer = require('gulp-autoprefixer');
var sassPath = '/path/to/sass';
var scssPath = '/path/to/scss';
var cssPath = '/path/to/css'
var jadePath = '/path/to/jade';
gulp.task('jade', function() {
gulp.src(jadePath + '/*.jade')
.pipe(jade())
.on('error', console.error.bind(console))
.pipe(gulp.dest('.'))
.pipe(browserSync.stream());
});
gulp.task('sass', function() {
gulp.src([sassPath + '/*.sass', scssPath + '/*.scss'])
.pipe(sass())
.on('error', console.error.bind(console))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.on('error', console.error.bind(console))
.pipe(gulp.dest(cssPath))
.pipe(browserSync.stream());
});
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: '.'
},
notify: false
})
});
gulp.task('watch', function() {
gulp.watch([sassPath + '/*.sass', scssPath + '/*.scss'], ['sass']);
gulp.watch(jadePath + '/*.jade', ['jade']);
});
gulp.task('default', ['sass', 'jade', 'watch', 'browser-sync']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment