我对Gulp很新,但我用它来管理我的构建过程以创建WordPress主题。我有我的package.json很好地设置,我想我的style.css来反映package.json。例如,如果我在package.json中将version
设置为0.0.2
,则style.css应该在运行构建任务后对其进行镜像。用Gulp从package.json创建一个WordPress style.css
作为又一个例子,如果我有这个作为我的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"
}
这将是我的style.css,运行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
*/
我已经有了安装了json-file
包,因为我使用gulp-file-include
来包含来自package.json的版本号以实现缓存清除。
你可以在这里查看我的整个gulpfile:https://github.com/revxx14/new-site/blob/master/gulpfile.js
很酷的概念。 – Plummer