Skip to content

Instantly share code, notes, and snippets.

@KimJoyFox
Last active September 12, 2019 19:14
Show Gist options
  • Select an option

  • Save KimJoyFox/dd1d0e8fe975b1a195c30f08ae03f62d to your computer and use it in GitHub Desktop.

Select an option

Save KimJoyFox/dd1d0e8fe975b1a195c30f08ae03f62d to your computer and use it in GitHub Desktop.
Starter Gulp.js File
var gulp = require('gulp');
var sass = require('gulp-sass');
var cleanCSS = require('gulp-clean-css');
var minify = require('gulp-minify');
var concat = require('gulp-concat');
gulp.task('styles', function() {
gulp.src('wp-content/themes/themename/assets/sass/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(cleanCSS())
.pipe(gulp.dest('wp-content/themes/themename/assets/css/'));
});
gulp.task('scripts', function() {
return gulp.src([
'!wp-content/themes/themename/assets/js/all.js',
'!wp-content/themes/themename/assets/js/all-min.js',
'wp-content/themes/themename/assets/js/*.js'])
.pipe(concat({ path: 'all.js'}))
.pipe(minify({
ext:{
src:'.js',
min:'-min.js'
},
}))
.pipe(gulp.dest('wp-content/themes/themename/assets/js/'));
});
gulp.task('watch',function() {
gulp.watch('wp-content/themes/themename/assets/sass/*.scss',['styles']);
gulp.watch('wp-content/themes/themename/assets/js/*.js',['scripts']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment