Skip to content

Instantly share code, notes, and snippets.

@fstiehle
Created December 21, 2018 04:29
Show Gist options
  • Save fstiehle/d0f35927c0face0560036acb46ed94e9 to your computer and use it in GitHub Desktop.
Save fstiehle/d0f35927c0face0560036acb46ed94e9 to your computer and use it in GitHub Desktop.
Gulp + WordPress + SASS + Autoprefix + LiveReload
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
rename = require('gulp-rename'),
livereload = require('gulp-livereload');
gulp.task('sass', function () {
return gulp.src('./sass/style.scss')
.pipe(sass.sync().on('error', sass.logError))
.pipe(autoprefixer('last 2 versions'))
.pipe(gulp.dest('./'))
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(rename({ suffix: '.min' }))
.pipe(livereload())
.pipe(gulp.dest('./'));
});
gulp.task('php', function () {
return gulp.src('./php/*.php')
.pipe(gulp.dest('./'));
});
gulp.task('default', function () {
livereload.listen(35729);
gulp.watch('./sass/**/*.scss', gulp.series('sass')).on('change', livereload.changed);
gulp.watch('**/*.php', gulp.series('php')).on('change', livereload.changed);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment