Yeoman generator for a WordPress starter theme (using Underscores) with npm and other good stuff
npm install generator-npm-wp-s-theme_s (Underscores) and optionally a npm package setup ready for development and production.
yo:
bash
npm install -g yo
`
##### Install generator-npm-wp-s-theme:
`bash
npm install -g generator-npm-wp-s-theme
`
$3
If this a new project (without a package.json file), start by:
##### Create a new directory, and go into:
`bash
mkdir my-new-theme && cd $_
`
##### Run yo npm-wp-s-theme, and fill the info:
`bash
yo npm-wp-s-theme
`
Next, enter your project information.
To install theme and start generator You must input Localhost address, domain site, theme name and theme slug.
Theme URI, author, author URI, author Email, description and bug report not required and are filled in at will.
Requests for adding files .gitignore, .editorconfig, .jshintignore, .stylelintrc and .npmrc are better left by default, and if necessary, make settings in them after installation
Usage
You're ready to go! Run any task by typing npm run task (where "task" is the name of the task in the "scripts" object). The most useful task for rapid development is watch. It will start a new server, open up a browser and watch for any SCSS, JS, PHP changes in the theme; once it compiles those changes, the browser will automatically reload page with injected the changeds!
List of main tasks
$3
npm run watch
Run the following tasks simultaneously: serve, watch:css, watch:js & watch:images. When a .scss, .js, .php or image file changes, the task will compile .scss and .js files, and the server will be notified of the change. Any browser connected to the server will then inject the new file.
#### build
npm run build
Copies all the files necessary for the project to the "dist" directory. There are files in the theme catalog and in the archive.
Compiles SCSS to CSS & add vendor prefixes, updates the language file.
List of useful tasks (one time)
#### lang
npm run lang
Updates the theme language file.
__*__First run add all options(textdomains, author, email..).
#### css
npm run css
Compiles SCSS to CSS, add vendor prefixes & minify/compress.
__*__ Minify files saving in "css" directory
#### uglify
npm run uglify`