Please Note: this project has moved from briancavalier/canhaz to cujojs/canhaz. Any existing forks have been automatically moved to cujojs/cram. However, you'll need to update your clone and submodule remotes manually.
Update the url in your .git/config, and also .gitmodules for submodules:
git://github.com/cujojs/canhaz.git
https://[email protected]/cujojs/canhaz.git
Helpful link for updating submodules: Git Submodules: Adding, Using, Removing, Updating
Canhaz is a project bootstrapping tool for generating stub files, similar to generator tools found in frameworks such as Ruby on Rails. The main difference is that canhaz is completely framework-independent, and highly-extensible through plugin generators.
Boilerplate is all that stuff you have to type before you can write the code you actually care about. It's your company copyright. It's your Javascript module wrapper, be it plain Javascript or AMD, or your Java package statement and class declaration wrapper. It's also all the stuff you might need to start a project, like much of the stuff that is provided by HTML 5 Boilerplate, for example, for an HTML site.
Boilerplate steals minutes of your day, but does almost nothing for your project.
It's time to stop typing it, and to canhaz it instead.
NOTE: Installation creates a symlink at /usr/local/bin/canhaz by default, so you may need to sudo to install.
The superfast do-you-trust-briancavalier install:
curl 'https://github.com/briancavalier/canhaz/raw/master/install.sh' | sh
Or, if you prefer, clone it and run the install.sh
script.
canhaz jquery.widget js/ui.myWidget
Creates the directory js, if necessary, and generates:
- ui.myWidget.js - jQuery widget skeleton, fill in your code!
- ui.myWidget.css - CSS skeleton for your widget
canhaz [--force] module_type module_path [generators]
--force
Force overwriting an existing dir. By default canhaz will not overwrite
an existing leaf dir, and it will warn you if you try to do so. If you
really want to overwrite it, use the --force :)
module_type
Type of "thing" to generate. Use --help, or look in the generators
directory to see what things canhaz knows about.
module_path
Path of the thing to generate. You can think of this as an AMD
module id, or as a relative filesystem path. The last part of the
path will be the name of the thing. Different generators may use
this information in slightly different ways.
generators
(optional)
You can list a subset of the components you'd like to generate. For
example, when generating a view, if you don't need a strings file, you
could do: canhaz my/view/MyView js scss css html test (i.e. leaving
out strings)
These are what you care about. Generators generate (duh) boilerplate for you. Here's what you get out of the box:
Makes it easy to start a new HTML5 project with HTML5 Boilerplate. Use it like this:
canhaz html.boilerplate myNewProject
cd myNewProject
## edit index.html...
canhaz html.page anotherPage
## edit anotherPage.html...
canhaz html.page sub/Page
## edit sub/Page.html...
profit
html.boilerplate - Fetches html5boilerplate from github, creates a new project dir, and injects your project name into the index.html file.
html.page - Fetches html5boilerplate's index.html from github, names it with the name you specify, and again injects that name into the HTML.
Generate stub JS for jQuery plugins, and JS and CSS for jQuery UI widgets. Use it like this:
canhaz jquery.plugin myPlugin
## edit js/myPlugin.js
## add myWidget.js to your build process
canhaz jquery.widget myWidget
## edit myWidget.js
## edit myWidget.css
## add myWidget.js and myWidget.css to your build process
profit
jquery.plugin - Generates a JS skeleton for a simple jQuery plugin.
jquery.widget - Generates a JS and CSS skeleton for a jQuery UI widget.
Canhaz is available under the MIT license. See LICENSE.txt for details.