Skip to content

Instantly share code, notes, and snippets.

@DavidFrahm
Created June 13, 2015 18:05
Show Gist options
  • Save DavidFrahm/30f01dec67a77f5dbacc to your computer and use it in GitHub Desktop.
Save DavidFrahm/30f01dec67a77f5dbacc to your computer and use it in GitHub Desktop.
Gulp config with expressive path variables
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