Plop generator for ad format scaffolding. Generates your formats and components folders.
- Install
plop
globally in your system.
npm install -g plop
- Install
plop
andplop-format-generator
locally in your project.
npm install --save-dev plop plop-format-generator
- In your
plopfile.js
, require theplop-format-generator
module and pass theplop
object and optionally some configuration.
var path = require('path');
module.exports = (plop) => {
require('plop-format-generator', {
basePath: path.resolve(__dirname, 'src', 'templates'),
prefix: 'template'
});
}
Attribute | Default | Description |
---|---|---|
basePath | src/templates | Path in which the generator will put the formats |
prefix | Adds a prefix to each generator followed by a : |
Run plop
to see the list of generators, or run plop [generator]
to use that generator.
template:format
: generates the initial format folder and defaults files, useindex.js
to import components and elements for the specific format.
> plop template:format
> Format name: Test Format
[CREATE] ./src/templates/testFormat/index.js
[CREATE] ./src/templates/testFormat/components.js
[CREATE] ./src/templates/testFormat/config.js
[CREATE] ./src/templates/testFormat/mockdata.js
[CREATE] ./src/templates/testFormat/index.scss
template:component
: generates a component folder with a ES6 class.
> plop template:component
> Component name: myNewComponent
> where would you like to put this component?
> edrBox
[CREATE] ./src/template/edrBox/components/myNewComponent/myNewComponent-view.js
[CREATE] ./src/template/edrBox/components/myNewComponent/myNewComponent-styles.scss
MIT