Package Exports
- liquid-to-handlebars
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (liquid-to-handlebars) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
liquid-to-handlebars 
Node.js lib for converting liquid templates to handlebars templates. Whipped this up as a quick and dirty, preliminary step to extracting HTML components from Bootstrap's docs, in a way that makes them actually reusable.
Install
Install with npm:
npm i liquid-to-handlebars --save-dev
Run tests
npm test
Usage
Don't expect miracles. For now, coverage is limited to converting Bootstrap's docs templates to handlebars.
var convert = require('liquid-to-handlebars');
// pass a string of HTML with liquid
console.log(convert('{liquid}'));
So replacement patterns for number of tags and filters have not been implemented. Here is the replacement pattern for converting {{content}}
liquid variables to {{> body }}
handlebars partials:
{
pattern: tag.makeVariable('content', {matter: ''}),
replacement: function (match, str) {
return '{{> body }}';
}
}
Feel free to do a PR to add replacement patterns.
Example project
To test drive the example:
git clone https://github.com/jonschlinkert/liquid-to-handlebars.git
Then cd
into the project and run npm install
.
Next, clone Bootstrap
Don't use Bower, use git clone
since we need to actual HTML docs:
git clone https://github.com/twbs/bootstrap.git "vendor/bootstrap"
Next, run
node examples/example
Converted files will be written to the ./results
directory.
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on October 16, 2014.