8000 GitHub - wombleton/jade-precompiler: Kanso package with build steps for precompiling .jade html templates
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wombleton/jade-precompiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Usage

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 compile pages/about.jade to pages/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
  }

Removing original .jade files

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
  }

About

Kanso package with build steps for precompiling .jade html templates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%
0