I’m pretty new to Gulp, but I’m using it to manage my build process for creating WordPress themes. I have my package.json set up nicely, and I’d like my style.css to reflect that package.json. For example, if I have my version
set to 0.0.2
in package.json, style.css should mirror that, after running my build task.
As a further example, if I have this as my package.json:
{
"name": "new-site",
"description": "A basic framework for a WordPress template",
"version": "0.0.1",
"repository": "https://github.com/revxx14/new-site",
"license": "MIT"
}
This would be my style.css, after running gulp build
:
/*
Theme Name: new-site
Theme URI: https://github.com/revxx14/new-site
Description: A basic framework for a WordPress template
Version: 0.0.1
License: MIT
*/
I’ve already got the json-file
package installed, as I’m using gulp-file-include
to include the version number from package.json for cache busting purposes.
You can view my entire gulpfile here: https://github.com/revxx14/new-site/blob/master/gulpfile.js
Figured this out, answer was super obvious.
Like I said, I’m already using
gulp-file-include
for added this very type of thing to my PHP files. For some reason I assumed this wouldn’t work with CSS files, but it works totally fine.