Created
May 24, 2013 10:02
-
-
Save klclee/5642533 to your computer and use it in GitHub Desktop.
This is originally from @williamcoates on github but fix some stuff so it works.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hbs = require 'hbs' | |
#for css | |
hbs.registerHelper 'css', (file, media) -> | |
media = "all" unless media.substring? | |
st = '' | |
require('xml2js').parseString css(file), (err, xml) -> | |
st = """<link href="#{xml.link.$.href}" media="#{media}" rel="stylesheet" type="text/css"/>""" | |
st | |
#for js | |
hbs.registerHelper 'js', (path) -> | |
js(path) | |
#for images | |
hbs.registerHelper 'img', (file) -> | |
"""<img src="#{img(file)}"/>""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment