WPGulp (WordPress Gulp) 🎯 An advanced & extensively documented Gulp WordPress workflow. Kick-start a build-workflow for your WordPress plugins and themes with Gulp. |
|
A FOSS (Free & Open Source Software) project. Maintained by @AhmadAwais. |
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
- For changes in files to recompile
- File types:
.css
,.html
,.php
,.js
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).
🎛 If you want to study the detailed installation of step
#1
,#2
, and#3
— then take a look at the steps below.
STEP #0
— Don't have Node.js
+ npm
installed? Read this. (CLICK TO EXPAND!)
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.
- 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 thescripts
,devDependencies
in your currentpackage.json
file and so on for other files. If you run the above command all similar files will be overwritten.
Configure the project paths and other variables inside the wpgulp.config.js
file. This is a compulsory step.
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
To optimize images and generate WP POT translation file, or generate a RTL stylesheet you can run the following commands
# To optimize images.
gulp images
# To generate WP POT translation file.
gulp translate
# To generate RTL stylesheets and Sourcemap.
gulp stylesRTL
- 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.
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.
'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!
Hello, we're the Dev Couple!
I (Ahmad Awais) am a OSS developer advocate, Full Stack Web Developer and a regular core contributor at WordPress. My significant other (Maedah Batool) is a Technical Project Manager, and she's also a WordPress Core Contributor. Together with our team, we run the TheDevCouple.com.
If you'd like to get insights into our love for open source software, professional full stack development, WordPress community, the growth of JavaScript or growing a family, building, and bootstrapping a business, then subscribe to our premium newsletter called ↣ The WordPress Takeaway!
If you'd like us to keep producing professional free and open source software (FOSS). Consider paying for an hour of my dev-time. We'll spend two hours on open source for each contribution. Yeah, that's right, you pay for one hour and get both of us to spend an hour as a thank you.
- 🚀 $99.99 — Support for one hour or more →
- 🔰 $49.99 — Support half an hour maintenance →
- ☕️ $9.99 — Buy us lunch or coffee to keep us trucking #OpenSource →
This open source project is maintained by the help of awesome businesses listed below. What? Read more about it →
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.
ahmadawais | MaedahBatool | akmur | marianrick | asharirfan | JeremyEnglert |
ajitbohra | noplanman | cdils | selrond | EugenioPetulla | FrankM1 |
isaacdanielanderson | JeffMatson | AdnanMuhib | mauryaratan | richtabor | saqibameen |
slushman |
Follow me 👋 on Twitter for more updates and questions →
For anything else, tweet at @MrAhmadAwais
I have released a video course to help you become a better developer — Become a VSCode Power User →
VSCode