Skip to content

Parse jade files for mixins and return them as an object of template functions.

Notifications You must be signed in to change notification settings

jonnyscholes/jademixinify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jademixinify - Jade mixins as template functions. Yaywoo!

Based on Jadeify. The only reason it's not a pull request is that its about as dirty as hacks can be.

Jademixinify lets you use [Jade][] mixins as template functions with [browserify][] in the simplest way possible.

This is a 0.0.1 release. It has no tests. You should not use this.

Ideally this will never reach 1.0 as it will become available in either Jadeify or Jade core.

Why?

We have a large library component library of composable mixins which we really like. I wanted to use these on the front end without having to copy compiled HTML and string mash it in my front end code. Jade doesnt expose mixins that are present in a file unless they are called in which case it exposes the rendered result. I'm abusing the dynamicMixins concept to expose them then hacking it into a series of functions that are usable.

Hopefully with 2.0 around the corner it will be easier to do this without all this dirtiness.

Usage?

template.jade:

mixin the-thing(title, link)
  a.title(href=link)= title

app.js:

var templates = require('./template.jade');
var theThingHtml = templates['the-thing']('The title', 'http://example.com/');

document.getElementById('the-thing').innerHTML = theThingHtml;

Setup

The rest of the docs are the same as Jadeify - go read them over there.

About

Parse jade files for mixins and return them as an object of template functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published