Skip to content

Instantly share code, notes, and snippets.

@morcegon
Created October 15, 2019 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morcegon/b6c6a65b83a2f7ee026b529fb7d2719d to your computer and use it in GitHub Desktop.
Save morcegon/b6c6a65b83a2f7ee026b529fb7d2719d to your computer and use it in GitHub Desktop.
wp gulp
const {
src,
dest,
parallel,
watch
} = require('gulp')
const sass = require('gulp-sass')
const autoprefixer = require('gulp-autoprefixer')
const browserify = require('gulp-browserify')
const srcPath = './src/'
const destPath = './wp-content/themes/fourunik/'
function compileSass () {
return src(`${srcPath}/sass/style.scss`)
.pipe(sass({
includePaths: [
'./node_modules/bulma/',
'./node_modules/bourbon/core/',
'./node_modules/slick-carousel/slick/',
]
}))
.pipe(autoprefixer())
.pipe(dest(`${destPath}`))
}
function compileScripts () {
return src(`${srcPath}/js/scripts.js`)
.pipe(browserify())
.pipe(dest(`${destPath}/js/`))
}
function copyImages () {
return src(`${srcPath}/img/**/*`)
.pipe(dest(`${destPath}/images/`))
}
function watchFiles () {
watch('./src/sass/*.scss', compileSass)
watch('./src/js/*.js', compileScripts)
watch('./src/img/**/*', copyImages)
}
exports.default = parallel(
compileSass,
compileScripts,
copyImages,
watchFiles
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment