Skip to content

Instantly share code, notes, and snippets.

@iamcarrico
Created July 21, 2014 14:43
Show Gist options
  • Save iamcarrico/656e3a41393cd1235829 to your computer and use it in GitHub Desktop.
Save iamcarrico/656e3a41393cd1235829 to your computer and use it in GitHub Desktop.
Sample Gulp Sass compile
// Compile Our Sass
gulp.task('sass', function() {
browserSync.notify('<span style="color: grey">Running:</span> Sass compiling');
return gulp.src(paths.sass)
.pipe(sass({
bundleExec: true,
style: 'expanded',
onError: browserSync.notify
}))
.pipe(prefix("last 2 versions", "> 1%"))
.pipe(gulp.dest('_src/css'))
.pipe(gulp.dest(paths.assets))
.pipe(browserSync.reload({stream:true}));;
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['lint', 'jekyll-rebuild']);
gulp.watch(paths.sassFiles, ['sass']);
gulp.watch(paths.imagesSrc, function() {
runSequence(['images'], ['jekyll-dev'])
});
gulp.watch(paths.jekyll, ['jekyll-rebuild']);
});
//////////////////////////////
// BrowserSync Task
//////////////////////////////
gulp.task('browserSync', function () {
browserSync.init([
'_site/' + paths.assets + '/**/*.css',
'_site/' + paths.assets + '/**/*.js',
'_site/**/*.html',
], {
server: {
baseDir: '_site'
},
host: "localhost"
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment