https://github.com/lasso-js/lasso-lodash
Lasso.js plugin to support compilation of Lodash templates
https://github.com/lasso-js/lasso-lodash
Last synced: 8 months ago
JSON representation
Lasso.js plugin to support compilation of Lodash templates
- Host: GitHub
- URL: https://github.com/lasso-js/lasso-lodash
- Owner: lasso-js
- Created: 2014-10-30T22:02:03.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-25T21:17:40.000Z (almost 11 years ago)
- Last Synced: 2025-03-02T12:16:46.547Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 141 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
optimizer-lodash
==============
Plugin for the [RaptorJS Optimizer](https://github.com/raptorjs/optimizer) that compiles Lo-Dash templates to CommonJS modules. These templates can easily be rendered using the [view-engine](https://github.com/patrick-steele-idem/view-engine) module (in conjunction with [view-engine-lodash](https://github.com/patrick-steele-idem/view-engine-lodash)).
# Installation
```bash
npm install optimizer-lodash --save
```
Enable the plugin:
```javascript
require('optimizer').configure({
plugins: [
'optimizer-lodash'
]
});
```
You will also need to install [view-engine](https://github.com/patrick-steele-idem/view-engine) and [view-engine-lodash](https://github.com/patrick-steele-idem/view-engine-lodash):
```bash
npm install view-engine --save
npm install view-engine-lodash --save
```
# Usage
Enable the Lo-Dash view engine:
```javascript
require('view-engine').register(
'lodash',
require('view-engine-lodash'));
```
Render templates on the client or server:
```javascript
var template = require('view-engine').load('./template.lodash');
template.render({
name: 'Frank'
},
function(err, output) {
console.log('Template output: ', output);
});
```