Giter Club home page Giter Club logo

jademixinify's Introduction

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.

jademixinify's People

Contributors

jonnyscholes avatar

Stargazers

Alexander Schwartzberg avatar

Watchers

James Cloos avatar  avatar

jademixinify's Issues

Still working?

I was wondering, after 2 years, is this still the way to go or did jade/pug introduce something similar out of the box?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.