Awesome
<div align="center"><small><p><em>π Learn to <a href="https://nodecli.com/?utm_source=github.com&utm_medium=referral&utm_campaign=ahmadawais/WPGulp" rel="nofollow">build CLI DevTools</a>, like WPGulp with me at <a href="https://nodecli.com/?utm_source=github.com&utm_medium=referral&utm_campaign=ahmadawais/WPGulp">NodeCLI.com</a>.</em></p></small>
<img src="https://a.cl.ly/o0uy14NY/c" alt="WP Gulp Β· WordPress Gulp" /> <h1><code>WordPress Gulp Workflow</code></h1> </div> <table width='100%' align="center"> <tr> <td align='left' width='100%' colspan='2'> <strong>WPGulp (WordPress Gulp)</strong><br /> π― An advanced & extensively documented Gulp WordPress workflow. Kick-start a build-workflow for your WordPress plugins and themes with Gulp. </td> </tr> <tr> <td> A FOSS (Free & Open Source Software) project. Maintained by <a href='https://github.com/ahmadawais'>@AhmadAwais</a>. </td> <td align='center'> <a href='https://twitter.com/MrAhmadAwais/'> <img src='https://img.shields.io/badge/β-AHMAD%20AWAIS-gray.svg?colorA=D14543&colorB=21759B&style=flat' width='100' /> </a> </td> </tr> </table> <br>π¦ WPGulp Can Do THATβ’
WPGulp
is an advanced & extensively documented Gulp.js
+ WordPress
workflow. It can help you kick-start a build-workflow for your WordPress plugins and themes with Gulp.js
, save you a lot of grunt work time, follow the DRY (Don't Repeat Yourself) principle, and #0CJS
Zero-config JavaScript startup but still configurable via wpgulp.config.js
file. It is:
- π₯ Versioned β
- π€ Updatable β
- π Set of sane-defaults β
π» DEV ENVIRONMENT
- Live reload browser with BrowserSync
- Hotloading styles with CSS Injection
π¨ STYLES
- Sass to CSS conversion
- Merging media queries
- Error handling
- Auto-prefixing
- Minification
- Sourcemaps
π JavaScript
- Concatenation
- Minification/uglification
- Separate vendor and custom JS files handling
π IMAGES
- Minification/optimization of images
- File types:
.png
,.jpg
,.jpeg
,.gif
,.svg
π― TRANSLATION
- Generates
.pot
translation file for i18n and l10n
π WATCHING
<br>
- For changes in files to recompile
- File types:
.css
,.html
,.php
,.js
Getting Started
β‘οΈ Quick Overview
Run step #1
, #2
, and #3
quickly in one go β Run inside local WP install's theme/plugin folder E.g. /wp.local/wp-content/plugins/your-plugin
or /wp.local/wp-content/themes/your-theme
directory.
# 1β Install WPGulp in your WordPress theme/plugin.
npx wpgulp
# 2β Now configure variables inside the `wpgulp.config.js` file.
# 3β Start your npm build workflow.
npm start
(npx is a package runner tool that comes with npm 5.2+ and higher).
<br> <details> <summary><strong><code>STEP #0</code></strong> β Don't have <code>Node.js</code> + <code>npm</code> installed? Read this. (CLICK TO EXPAND!)</summary>π If you want to study the detailed installation of step
#1
,#2
, and#3
β then take a look at the steps below.
In case you are an absolute beginner to the world of Node.js
, JavaScript, and npm
packages β all you need to do is go to the Node's site download + install Node on your system. This will install both Node.js
and npm
, i.e., node package manager β the command line interface of Node.js.
You can verify the install by opening your terminal app and typing...
node -v
# Results into v9.11.2 β make sure you have Node >= 8 installed.
npm -v
# Results into 6.2.0 β make sure you have npm >= 5.3 installed.
</details>
β STEP #1
β Download the Required Files
- In the terminal go to the root folder of your WordPress plugin/theme
- Run the following command to download all the files in the WPGulp/src folder
It'll take a couple of minutes to install.
npx wpgulp
(npx is a package runner tool that comes with npm 5.2+ and higher).
β οΈ I'm assuming that there are no previously present similar files in the root of your folder. Otherwise, you need to merge these very carefully. E.g. You can include the
scripts
,devDependencies
in your currentpackage.json
file and so on for other files. If you run the above command all similar files will be overwritten.
β STEP #2
β Editing the Project Variables
Configure the project paths and other variables inside the wpgulp.config.js
file. This is a compulsory step.
β STEP #3
β Start your project
Once the installation is done, you can open your project (WordPress plugin/theme) folder and run the start script.
npm start
# To stop press CTRL (β) + C
β OPTIONAL STEP #4
β More Scripts/Tasks
To optimize images and generate WP POT translation file, or generate a RTL stylesheet you can run the following commands
# To optimize images.
npm run images
# To generate WP POT translation file.
npm run translate
# To generate RTL stylesheets and Sourcemap.
npm run styles-rtl
# To generate theme/plugin zip file without extranious files.
npm run zip
<br>
How to Update?
- Download all the latest files in the WPGulp/src folder inside the root folder of your WordPress plugin/theme by running
npx install-wpgulp
it will overwrite all the wpgulp files. - Open terminal and Install WPGulp's node dependencies by running the
npm install
commands in the root folder of your WordPress plugin/theme.
Changelog
Read what's π¦ new, π improved, π fixed, and if π docs got updated.
π Go read the entire changelog at this link β WPGulp Changelog β
Nothing's ever complete, so bear with us while we keep iterating towards a better future.
<br>'Coz every night I lie in bed The brightest colors fill my head A million dreams are keeping me awake I think of what the world could be A vision of the one I see A million dreams is all it's gonna take A million dreams for the world we're gonna make ...
... listen to β A million dreams!
Sponsor
Me (Ahmad Awais) and my incredible wife (Maedah Batool) are two engineers who fell in love with open source and then with each other. You can read more about me here. If you or your company use any of my projects or like what Iβm doing then consider backing me. I'm in this for the long run. An open-source developer advocate.
NodeCLI.com β Learn to build Node.js CLI Automation
This repository is part of the NodeCLI.com course.
After building hundreds of developer automation tools used by millions of developers, I am sharing exactly how you can do it yourself with minimum effective effort. Learn to build Node.js & JavaScript based CLI (Command Line Interface) apps. Automate the grunt work, do more in less time, impress your manager, and help the community. β I'm sharing it all in this online video course. Node CLI Automation without wasting a 1,000 hours β</p>
π THEDEVCOUPLE PARTNERS
This open source project is maintained by the help of awesome businesses listed below. What? Read more about it β
<table width='100%'> <tr> <td width='500'><a target='_blank' href='https://kinsta.com/?kaid=WMDAKYHJLNJX&utm_source=TheDevCouple&utm_medium=Partner'><img src='https://a.cl.ly/4guJenp9' /></a> <td width='500'><a target='_blank' href='https://ipapi.com/?utm_source=TheDevCouple&utm_medium=Partner'><img src='https://a.cl.ly/z8uYQO2O'/></a></td> </tr> </table> <br>License & Attribution
MIT Β© Ahmad Awais.
This project is inspired by the work of many awesome developers especially those who contribute to this project, Gulp.js, Babel, and many other dependencies as listed in the package.json
file. FOSS (Free & Open Source Software) for the win.
<img alt="slushman" src="https://avatars0.githubusercontent.com/u/2255645?v=4&s=117" width="117"> |
---|
slushman |