Created
June 13, 2015 18:05
-
-
Save DavidFrahm/30f01dec67a77f5dbacc to your computer and use it in GitHub Desktop.
Gulp config with expressive path variables
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
var gulp = require('gulp'); | |
var connect = require('gulp-connect'); | |
var sass = require('gulp-sass'); | |
var paths = { | |
sassEntryPointFile: './scss/main.scss', | |
sassInputFiles: ['./scss/**/*.scss'], | |
cssOutputFolder: './css/', | |
htmlInputFiles: ['./manage/**/*.html'] | |
}; | |
gulp.task('default', ['connect', 'sass', 'watch']); | |
gulp.task('connect', function () { | |
connect.server({ | |
root: './', | |
port: 8000, | |
livereload: true | |
}); | |
}); | |
gulp.task('sass', function (done) { | |
gulp.src(paths.sassEntryPointFile) | |
.pipe(sass({sourcemap: 'inline'})) | |
.pipe(gulp.dest(paths.cssOutputFolder)) | |
.on('end', done); | |
}); | |
gulp.task('watch', function() { | |
gulp.watch(paths.sassInputFiles, ['sass']); | |
gulp.watch(paths.htmlInputFiles, ['reload']); | |
gulp.watch(paths.cssOutputFolder, ['reload']); | |
}); | |
gulp.task('reload', function () { | |
gulp.src(paths.htmlInputFiles) | |
.pipe(connect.reload()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment