https://github.com/seebigs/bundl-wrap
https://github.com/seebigs/bundl-wrap
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/seebigs/bundl-wrap
- Owner: seebigs
- Created: 2016-01-04T23:25:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-05-17T19:41:22.000Z (about 8 years ago)
- Last Synced: 2025-02-15T20:52:54.785Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bundl-wrap
*Wrap your bundles with a string or template*
*Runs with the amazing [Bundl](https://github.com/seebigs/bundl) build tool and [Easybars](https://github.com/seebigs/easybars) templating*
## Install
```
$ npm install --save-dev bundl-wrap
```
## Use
```js
var Bundl = require('bundl');
var wrap = require('bundl-wrap');
var options = {
before: '(function(){',
after: ')();'
};
new Bundl(targets)
.then(wrap(options))
.then(write())
.go();
```
## Options
### before
Text to come before your content (can use template values)
### after
Text to come after your content (can use template values)
### data
The data object that will be available to your templates
*Note: "{{___}}" (triple underscore) is a magic value that is always available to your templates, even when no data is passed. It represents the full original contents.*
### file
A file path to find a template to pass content through
## Example
```js
var options = {
data: {
name: 'Juliet',
location: 'window',
direction: 'East',
exclamation: 'soft'
},
before: 'But {{exclamation}}, ',
after: ', and {{name}} is the sun.',
file: '../my_template.txt'
};
```
my_template.txt
```
what light through yonder {{location}} breaks?
{{ ___ }}
It is the {{direction}}
```
Output:
```
But soft, what light through yonder window breaks?
ORIGINAL CONTENT
It is the East, and Juliet is the sun.
```