Created
October 15, 2019 14:40
-
-
Save morcegon/b6c6a65b83a2f7ee026b529fb7d2719d to your computer and use it in GitHub Desktop.
wp gulp
This file contains hidden or 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
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