Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
a project and code bootstrapping tool that will save you tons of typing. Stop typing boilerplate, canhaz it instead!
Branch: master
Pull request Compare This branch is even with cujojs:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
generators
LICENSE.txt
README.mdown
config
install.sh

README.mdown

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://cujojs@github.com/cujojs/canhaz.git

Helpful link for updating submodules: Git Submodules: Adding, Using, Removing, Updating


canhaz

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 sucks. Unfortunately, it is also necessary

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.

Quick Start

Install it

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.

Run it

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

Usage

canhaz [--force] module_type module_path [generators]

Options

--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)

Generators

These are what you care about. Generators generate (duh) boilerplate for you. Here's what you get out of the box:

HTML5 Boilerplate

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.

jQuery

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.

License

Canhaz is available under the MIT license. See LICENSE.txt for details.

Something went wrong with that request. Please try again.