This is a Jade to HTML compiler for the Mimosa build tool. This module is for use with Mimosa 2.0+
.
For more information regarding Mimosa, see http://mimosa.io
Add 'jade-static'
to your list of modules. That's all!
Mimosa will install the module for you when you start mimosa watch
or mimosa build
.
After that, start creating your .jade files in the app/template
folder. This files will be converted to HTML strings
which are available on client-side through the templates
object — the same as with other templating modules.
This module will compile Jade files to HTML during mimosa watch
and mimosa build
.
This module utilizes all of the built-in template behavior that comes with Mimosa's basic template compiler.
See the mimosa website for more information about how templates are treated
or check out the various template
configuration options.
jade:
lib: undefined
extensions: [ "jade" ]
context: null
-
lib
: You may want to use this module but may not be ready to use the latest version of Jade. Using thelib
property you can provide a specific version of Jade if the one being used by this module isn't to your liking. To provide a specific version, you must have itnpm install
ed into your project and then provide it tolib
. For instance:lib: require('jade')
. -
extensions
: an array of strings, the extensions of your Jade files. -
context
: an object passed to the compiled template function when generating HTML. Ifcontext
is a function itself, it's being executed and the result is used as a context for the template.
There are several similar modules for Mimosa, let's see how do they differ from each other:
-
mimosa-html-templates
takes theassets/javascripts/app/template/fileName.template
HTML file and makes its content available as a stringtemplates['fileName']
. -
mimosa-jade
takes theassets/javascripts/app/template/fileName.jade
Jade file and makes its content available as a functiontemplates['fileName']
. You can then call this function from your client-side code. -
mimosa-client-jade-static
takes theassets/javascripts/app/template/fileName.html.jade
Jade file and transforms it topublic/javascripts/app/template/fileName.html
file. -
mimosa-jade-static
(this module) takes theassets/javascripts/app/template/fileName.jade
Jade file and makes its content available as an HTML stringtemplates['fileName']
.
So, this module is basically the same as mimosa-html-templates
,
but allowing you to write you code in Jade.
One particular use-case is when your framework allows programmatically passing chunks of HTML (potentially containing some client-side Mustache or EJS-like template instructions). For example, Angular allows you to pass HTML for custom components, and for "partials" — see official examples "Javascript Projects" and "Todo", correspondingly.
A full-featured sample project using Mimosa, Angular, RequireJS and this module can be found here.