npm install jaded| Package | jaded |
| Description | Collection of Jade plugins |
| Node Version | >= 0.4 |
```
sudo npm install jaded -g
`
Usage: jaded [options]
Options:
-h, --help output usage information
-V, --version output the version number
-i --input [folder] Specify input folder
-o --output [folder] Specify output folder
-d --development Beautify output
-a --amd Wrap output in AMD closure
-r --rivets Add rivets bindings via ${}
`
Use ${} where you would usually use #{} to watch the object for changes. The template function now takes two arguments - a selector for where the template will be rendered ("#content") and a locals object.
`coffeescript
#auction
h1 ${auction.title}
img(src='${auction.image_url}')
br
span ${auction.timeRemaining | time}
.alert-box(show='${auction.endingSoon}')
p Hurry up! This auction is ending soon.
dl
dt Highest Bid:
dd ${auction.bid | currency}
dt Bidder:
dd ${auction.bidder}
`
compiles to
` Hurry up! This auction is ending soon.html`
jaded modifies the jade package to allow processing through middleware - just specify the node type and a handler
`coffeescript
jade = require 'jade'
require 'jaded' # this will load the hooks
jade.use 'Tag', (node) ->
# Do stuff to node here
return node
``
(MIT License)
Copyright (c) 2012 Fractal
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.