broccoli-vulcanize-html-imports
Version:
Broccoli plugin for vulcanizing HTML imports with Polymer Vulcanize tool
60 lines (46 loc) • 1.64 kB
Markdown
[](https://travis-ci.org/mbykovskyy/broccoli-vulcanize-html-imports)
[][broccoli] plugin for vulcanizing HTML imports with [Polymer vulcanize][polymer-vulcanize] tool. It strips out HTML imports from files and then vulcanizes the import files. This is useful for preprocessing templates before compiling them.
```bash
npm install --save-dev broccoli-vulcanize-html-imports
```
```js
var vulcanize = require('broccoli-vulcanize-html-imports');
var inputTree = 'templates';
var options = {
extensions: ['html', 'hbs'],
outputFile: 'assets/components.html',
overwrite: true,
excludes: [/^data:/, /^http[s]?:/, /^\//],
abspath: '/webroot/',
stripExcludes: false,
stripComments: false,
inlineScripts: false,
inlineCss: false,
implicitStrip: false
};
module.exports = vulcanize(inputTree, options);
```
**Input Tree**
```
templates
+ - components
| + - component.hbs
+ - page.html
```
**Output Tree**
```
.
+ - assets
| + - components.html
| + - components.js
+ - components
| + - component.hbs
+ - page.html
```
The `assets\components.html` and `assets\components.js` are vulcanized import files and `components\component.hbs` and `page.html` are stripped out of HTML imports except the ones that are specified in `excludes` option.
See [polymer vulcanize][polymer-vulcanize] for details on `options`.
[]: https://github.com/broccolijs/broccoli "Broccoli"
[]: https://github.com/Polymer/vulcanize "Polymer vulcanize"