Skip to content

nymag/generator-clay-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

generator-clay-component

A yeoman generator for Clay components!

Circle CI npm version

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.

  1. What does this component do? – Write a short, one-line description of your component
  2. What tag should this component use? – Select the tag you want to use (or comment, for a component that lives in the <head>)
  3. Does it need client-side javascript? – This will create a client.js with a dollar-slice controller
  4. Does it need server-side javascript? – This will create a server.js and server.test.js for you do logic on GET and PUT

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.