In my own scaffold, I have this thing in my gulpfile, to save myself from the search/replace life. You might find it helpful :) It uses gulp-prompt and gulp-replace, and keyed to a gulp setup command. It's a bit old and needs cleanup and refining, but it works really well and is so quick.
/**
* Task: Get the Terms
*
* Creates multiple user prompts used during Setup to make the necessary changes to the theme
*
*/
function get_the_terms() {
return src(['*.php', '**/*.php', 'scss/style.scss']).pipe(
prompt.prompt(
[
{
type: 'input',
name: 'theme',
message: 'Enter your theme name (e.g. WP Workflow Website):',
},
{
type: 'input',
name: 'textdomain',
message: "Enter your theme's text domain (e.g. wp-workflow):",
},
{
type: 'input',
name: 'url',
message: "Enter your theme's URL:",
},
{
type: 'input',
name: 'author',
message: 'Enter your name:',
},
{
type: 'input',
name: 'authorurl',
message: 'Enter your URL:',
},
{
type: 'input',
name: 'package',
message:
'Enter package name (e.g. workflow_supercharged, make sure spaces are underscores):',
},
{
type: 'input',
name: 'projecturl',
message: 'Enter your Local URL (without the protocol):',
},
],
(result) => {
themename = result.theme;
textdomain = result.textdomain;
url = result.url;
author = result.author;
authorurl = result.authorurl;
package = result.package;
localurl = result.projecturl;
},
),
);
}
/**
* Task: Replace the Terms in PHP (there's also one for SCSS but you get the idea)
* (this needs some updating, but works for now)
*/
function replace_terms_in_php() {
return src(['*.php', '**/*.php', '!build/**/*.php'])
.pipe(replace('function workflow_supercharged', 'function ' + package))
.pipe(replace('@package workflow_supercharged', '@package ' + package))
.pipe(replace('workflow_supercharged', textdomain))
.pipe(dest('.'));
}
In my own scaffold, I have this thing in my gulpfile, to save myself from the search/replace life. You might find it helpful :) It uses
gulp-promptandgulp-replace, and keyed to agulp setupcommand. It's a bit old and needs cleanup and refining, but it works really well and is so quick.