Add jade-precompiler
to your dependencies section in kanso.json
.
...
"dependencies": {
"jade-precompiler": null,
...
}
run
kanso install
to fetch the package
To tell the precompiler which jade files to transform, add a section called jade
to kanso.json
and put in the files you want to process.
...
"jade": {
"compile": [ "pages/about.jade", ... ]
}
Running
kanso push
will compilepages/about.jade
topages/about.html
and upload it to_attachments/pages/about.jade
.
Alternately you can compile all jade files under a directory.
...
"jade": {
"compile": [ "pages", ... ]
}
Or all jade files anywhere in the kanso project.
...
"jade": {
"compile": true
}
###Parameter objects
It is possible to pass an object to each of the jade files. Define it under the key constants
The constants
section will fade out in future releases. Versions from 0.1.0
and up will not pass the constants
object to the jade templates. Instead, the whole
kanso.json
will be made available to the templates. -- see below.
...
"jade": {
"compile": [ ... ],
"constants": {
"environment": "dev",
"author": {
"name": "skiqh",
"site": "https://github.com/skiqh/jade-precompiler"
}
}
}
Used with a template con 6066 taining these lines,
#title
h1 The infamous jade preprocessor for kanso
span.tag= environment
#contact
a(href='#{author.site}')= author.name
the jade-preprocessor will yield
<div id="title">
<h1>The infamous jade preprocessor for kanso</h1>
<span class="tag">dev</span>
</div>
<div id="contact">
<a href="https://github.com/skiqh">skiqh</a>
</div>
If you ommit the constants
section, the jade-precompiler will pass the whole settings object
to your templates. This whole thing will come in very handy once kanso is able to override the
entries in kanso.js
with values from the .kansorc
-environment you chose at the commandline,
like kanso push production
. (see kanso/kanso#353 for detals.)
###Compression
The jade-preprocessor can be told to compress the output through the compress
flag (internally,
jade refers to this as the pretty
flag, but we stick to the more canonical compress
, just like in the
less- and stylus-precompilers).
...
"jade": {
"compile": [ ... ],
"compress": true
}
You can also remove any .jade files from attachments (if you placed them inside a
directory also added as static files), by adding the remove_from_attachments
property. This will remove all attachment with a .jade
extension!
...
"jade": {
"compile": [ ... ],
"remove_from_attachments": true
}