Created
July 21, 2014 14:43
-
-
Save iamcarrico/656e3a41393cd1235829 to your computer and use it in GitHub Desktop.
Sample Gulp Sass compile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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