A ractive component/template browserify transform which allows for embedded transpilable languages for javascript or css (like livescript, coffeescript, and scss!).
npm install ractiveifyBrowserify transform and general ractive component parser (see ractiveify.parse below).
Browserify transform for ractive components (and by extension templates) which allows for compilation of embedded scripts and styles!
This module plays very nicely with debowerify and deamdify! I'm using it in my current project. Which is why I don't have any tests...yet...
However! Debowerify (the original) filters out extensions. Which is why I made my own fork at norcalli/debowerify which
accepts an extensions option (debowerify.extensions.push('ract')). This is the only way
that debowerify will work with ractive components which have been require'd.
You can include this in your package.json by simply switching the version to norcalli/debowerify
like this:
``js`
"dependencies": {
...
"debowerify": "norcalli/debowerify"
...
}
js
var ractiveify = require('ractiveify');ractiveify.extensions.push('ractive');
var b = browserify();
b.transform(ractiveify);
b.bundle();
`Example component file
'messages.ract'
`hbs
{{#each filter(messages)}}
{{.}}
{{/each}}
`var messageTemplate = require('./messages.ract');
messageTemplate will then be populated as such:
`js
messageTemplate == {
template: ...
css: ...
init: function() {}
data:
filter: ...
messages: ...
`The transform will populate the
template property with the markup, the
css property with the compiled output of your