Skip to content

Instantly share code, notes, and snippets.

@hugodias
Created August 3, 2015 16:21
Show Gist options
  • Save hugodias/1fd4b5af6e965998da2f to your computer and use it in GitHub Desktop.
Save hugodias/1fd4b5af6e965998da2f to your computer and use it in GitHub Desktop.
Gulpfile for wordpress theme development.
/**
* Place this file in your theme root (wp-content/themes/yourtheme/gulpfile.js)
*
* Run: $ gulp
*
* */
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
proxy: "http://app.dev"
});
gulp.watch("sass/**/*.scss", ['sass']);
gulp.watch("js/*.js").on('change', browserSync.reload);
gulp.watch("*.php").on('change', browserSync.reload);
gulp.watch("**/*.php").on('change', browserSync.reload);
});
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src("sass/*.scss")
.pipe(sass())
.pipe(gulp.dest("css"))
.pipe(browserSync.stream());
});
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment