Created
August 3, 2015 16:21
-
-
Save hugodias/1fd4b5af6e965998da2f to your computer and use it in GitHub Desktop.
Gulpfile for wordpress theme development.
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
/** | |
* 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