codesleeve / l4-asset-handlebars
Installs: 31 203
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 2
Language:JavaScript
Requires
- php: >=5.3.0
- illuminate/support: 4.0.x
Requires (Dev)
- codesleeve/asset-pipeline: dev-master
This package is not auto-updated.
Last update: 2022-02-01 12:26:45 UTC
README
Bring in your .jst.hbs
JST templates and also Handlebars into your Laravel 4 application.
Installation
Begin by installing this package through Composer. Edit your project's composer.json
file to require codesleeve/l4-asset-handlebars
.
It might look something like:
"require": { "laravel/framework": "4.0.*", "codesleeve/l4-asset-handlebars": "dev-master" }
Next, update Composer from the Terminal:
composer update
Once this operation completes, add the service provider. Open app/config/app.php
, and add a new item to the providers array.
'Codesleeve\L4AssetHandlebars\L4AssetHandlebarsServiceProvider'
Usage
Once installed you can add this your Asset pipeline manifest file [laravel_root]/app/assets/javascripts/application.js
//= require handlebars
Now create a file app/assets/javascripts/myfirst.jst.hbs
<div> Put some html here, {{smeagol}} </div>
After refreshing the page inspect JST object in the javascript console and the function
JST['myfirst']({smeagol: 'precious!!!'})
which should give you
<div> Put some html here, previous </div>