Created
February 12, 2016 16:10
-
-
Save selahattinunlu/a4feda575ced84768bb3 to your computer and use it in GitHub Desktop.
Basic Gulpfile - Sass
This file contains hidden or 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
var gulp = require('gulp'), | |
sass = require('gulp-sass'); | |
var sassConfig = { | |
inputDirectory: 'resources/sass/**/*.scss', | |
outputDirectory: 'assets/css', | |
options: { | |
outputStyle: 'expanded' | |
} | |
} | |
gulp.task('build-css', function() { | |
return gulp | |
.src(sassOptions.inputDirectory) | |
.pipe(sass(sassConfig.options).on('error', sass.logError)) | |
.pipe(gulp.dest(sassConfig.outputDirectory); | |
}); | |
gulp.task('watch', function() { | |
gulp.watch('resources/sass/**/*.scss', ['build-css']); | |
}); |
Line 14: should be sassConfig, not sassOptions.
Also charneykaye's comment is relevant.
Also, if you are running Gulp 4.x, you will want to change Line 20 to be something like:
gulp.watch('path/to/watch', gulp.series('build-css'))
Other than those small things, this is a very good base for a front-end newb like myself to get a gulpfile off the ground.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! This is great. Note missing final parens on line 16. Also I added a default task: