Skip to content

Instantly share code, notes, and snippets.

@ajschlosser
Last active August 29, 2015 14:06
Show Gist options
  • Save ajschlosser/3ac4e7c15eb43703b8d5 to your computer and use it in GitHub Desktop.
Save ajschlosser/3ac4e7c15eb43703b8d5 to your computer and use it in GitHub Desktop.
A very basic gulpfile.js for web development (with Jade and PHP support).
/*
* Base Gulp.js workflow
* for simple front-end projects
* author: Aaron John Schlosser
* url: http://www.aaronschlosser.com
*/
var gulp = require("gulp"),
gutil = require("gulp-util"),
concat = require("gulp-concat"),
watch = require("gulp-watch"),
compass = require("gulp-compass"),
jade = require("gulp-jade-php"),
plumber = require("gulp-plumber")
var paths = {
styles: {
src: "./scss/**/*.scss",
dest: "./stylesheets"
},
templates: {
src: "./templates/**/*.jade",
dest: "./"
}
};
function handleError(err) {
console.log(err.toString());
this.emit('end');
}
gulp.task("styles", function() {
return gulp.src(paths.styles.src)
.pipe(plumber())
.pipe(compass({
css: "./stylesheets",
sass: "./scss",
image: "./images"
}))
.on('error', handleError)
.pipe(plumber.stop())
.pipe(gulp.dest(paths.styles.dest));
});
gulp.task("templates", function() {
gulp.src("./templates/**/*.jade")
.pipe(plumber())
.pipe(jade())
.pipe(plumber.stop())
.pipe(gulp.dest("./"));
});
gulp.task("default", function() {
gulp.watch(paths.styles.src, ["styles"]);
gulp.watch(paths.templates.src, ["templates"]);
});
@ajschlosser
Copy link
Author

To install dependencies, run the following command in the same directory as gulpfile.js:

sudo npm install --save-dev gulp gulp-util gulp-concat gulp-watch gulp-compass gulp-jade-php gulp-plumber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment