libtemplate makes it easier to start writing JavaScript libraries. It has been designed to be used with GitHub (and GitHub pages). In addition it uses Grunt as a build system.
- git clone git@github.com:bebraw/libtemplate.js.git mylib
- cd mylib
- rm -rf .git
- git init
- git add .
- git commit
As you can see this workflow loses the version history and gives you a blank slate to get started with.
After you have done that npm install
the dependencies. In addition you will
need to set up Jekyll and
Pygments in case you wish to use syntax highlighting.
Now that everything should be set up, invoke grunt
. You should have a nice,
interactive development server running. Surf to localhost:4000
at your browser.
If you have set up LiveReload
extension
the changes you make to the project _meta
data or package.json
should cause
the browser window to refresh automatically. This allows you to prototype your
project README.md
and site in a quick manner.
Besides the basic grunt
functionality, there are various helpers around. I've
listed these in the following list:
grunt build
updates project files based on metadata. Handy if you just want to make some quick change.scripts/pu.sh
pushes the current changes to GitHub. In addition it pushes the contents of the master branch to gh-pages so the index shows up properly at GitHub Pages. It also pushes your tags to GitHub.
This bit is here just to illustrate how Pygments works. The example will render with syntax highlighting on both README.md and GitHub Pages index.
var a = 4;
function add(a, b) {
return a + b;
}
libtemplate is available under MIT. See LICENSE for more details.