Gulp Webpack Starter - A simple web-development toolkit using Gulp task runner and Webpack bundler. Ideal for building static HTML templates, speeding up Wordpress theme development, or any similar template-driven and front-end project.
Features | Description |
---|---|
CSS | SASS, SMACSS, Autoprefixer, clean-css |
JS | Webpack, Babel |
Testing | Jest |
Live Reload | BrowserSync, Webpack Dev Middleware, Webpack Hot Middleware |
HTML | gulp-file-include |
Images | gulp-imagemin |
SVG sprite | gulp-svg-sprite |
Deployment | vinyl-ftp |
Make sure you have the following installed:
Recommended to use node 8.9. (last LTS version)*
git clone https://github.com/wwwebman/gulp-webpack-starter <my-project-name>
cd <my-project-name>
yarn
yarn start
Easy, right?
Install Wordpress on you localhost (MAMP, LAMP)
cd
into your theme directory. E.g.:
cd project/wp-content/themes/customTheme/
git clone https://github.com/wwwebman/gulp-webpack-starter frontEnd
cd frontEnd
Certain defaults will need to be changed in tasks/config.json* for WP development.
- Change the global assets output, since we want to export assets to the theme root directory:
"dist": "../"
- Disable the
html
run
task, since we don’t need to compile HTML in this project:
"html": {
"run": false
},
- Now, browserSync should use proxy instead of creating a static server:
target
should refer to the location (pwd
) of your local WordPress installationpublicPath
should refer to the folder to which you’re outputting thebundle.js
file. The Reason - issue GWS - 3
"proxy": {
"target": "localhost/project",
"publicPath" : "http://localhost:3333/project/wp-content/themes/customTheme/dist/assets/js",
}
yarn
yarn start
yarn <script> //alternative: npm run <script>
yarn start //Run development mode
yarn build //Compiles your App for production
yarn deploy //Push production version on remote server using FTP