generator-clay-component
v1.3.0
Published
A yeoman generator for Clay components!
Downloads
4
Readme
generator-clay-component
A yeoman generator for Clay components!
Installation
npm install --global generator-clay-component
Or you can use the yeoman interactive menu!
Usage
First, make sure you're running this generator from the root directory of your Clay instance!
To create a new component, simply call the generator with the component's name. Make sure to use kebab-case!
yo clay-component foo-bar
The generator will ask you a few short questions, then spin up the new component in your components/foo-bar
folder.
- What does this component do? – Write a short, one-line description of your component
- What tag should this component use? – Select the tag you want to use (or
comment
, for a component that lives in the<head>
) - Does it need client-side javascript? – This will create a
client.js
with a dollar-slice controller - Does it need server-side javascript? – This will create a
server.js
andserver.test.js
for you do logic onGET
andPUT
Interactive prompts are nice, but who has the time? My twitter feed won't read itself!
You can also use command line flags for all of these options:
--desc <words>
or-d <words>
– description--tag <tag name>
or-t <tag name>
– tag (note: you can also specify custom tags this way!)--client
or-c
– if you want client scripts--server
or-c
– if you want server scripts
If you're a speed daemon, your component might look like this:
yo clay-component fizz-buzz-enterprise -d "FizzBuzz Enterprise Edition" -t article -cs
Contributing
We're busy people, so we probably missed something! Let us know by submitting an issue, or better yet submit a pull request with a failing test. We use linting tools and unit tests, which are built constantly using continuous integration.