angular-tpl2js
Advanced tools
Comparing version 0.0.5 to 0.0.6
16
index.js
@@ -55,2 +55,3 @@ var async = require('async'); | ||
_config.HTMLMinifier = merge(HTMLMinifier, (config.HTMLMinifier || {})); | ||
_config.include = config.include || false; | ||
} | ||
@@ -101,3 +102,3 @@ } | ||
if ($($.html()).find('[ng-include]').length > 0 && _config.includes) { | ||
if ($($.html()).find('[ng-include]').length > 0 && _config.include) { | ||
t = embedIncludes($.html(), source.templates[index]) | ||
@@ -143,3 +144,2 @@ } | ||
// TODO - recurse deeply nested ng-include templates | ||
// TODO - README | ||
@@ -153,6 +153,12 @@ function TemplateManager() { | ||
engine = new TemplateEngine(); | ||
engine.config.set(config); | ||
if(arguments.length === 2 && Object.prototype.toString.call(arguments[1]) == '[object Function]') { | ||
done = config; | ||
} else { | ||
engine.config.set(config); | ||
} | ||
// more robust gulp check mayhaps? | ||
if (typeof input === 'object') { | ||
var base = '/' + path.dirname(path.relative(__dirname, config.target)); | ||
@@ -163,4 +169,6 @@ var source = engine.source.hash(input.toString(), base); | ||
engine.templates.set(transformed).then(function (output) { | ||
done(output); // -- out | ||
done(null, output); // -- out | ||
}); | ||
}, function (error) { | ||
done(error); | ||
}); | ||
@@ -167,0 +175,0 @@ } else { |
{ | ||
"name": "angular-tpl2js", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Convert Angular templates to inline JavaScript", | ||
@@ -5,0 +5,0 @@ "files": [ |
# angular-tpl2js | ||
> awesomeness coming soon | ||
[![Build Status](https://img.shields.io/travis/scniro/angular-tpl2js.svg?style=flat-square)](https://travis-ci.org/scniro/angular-tpl2js) | ||
[![NPM Version](https://img.shields.io/npm/v/angular-tpl2js.svg?style=flat-square)](https://www.npmjs.com/package/angular-tpl2js) | ||
[![Dependency Status](https://img.shields.io/david/scniro/angular-tpl2js.svg?label=deps&style=flat-square)](https://david-dm.org/scniro/angular-tpl2js) | ||
[![devDependency Status](https://img.shields.io/david/dev/scniro/angular-tpl2js.svg?label=devDeps&style=flat-square)](https://david-dm.org/scniro/angular-tpl2js#info=devDependencies) | ||
[![devDependency Status](https://img.shields.io/david/dev/scniro/angular-tpl2js.svg?label=devDeps&style=flat-square)](https://david-dm.org/scniro/angular-tpl2js#info=devDependencies) | ||
## Install | ||
``` | ||
npm install angular-tpl2js --save-dev | ||
``` | ||
## API | ||
### inline(*path*, [*config*], *callback*) | ||
```javascript | ||
var tpl2js = require('angular-tpl2js'); | ||
tpl2js.inline('/js/directive.js', function (err, result) { | ||
// result = directive.js with template inline | ||
}); | ||
``` | ||
#### config | ||
`include` for retrieving [ng-include](https://docs.angularjs.org/api/ng/directive/ngInclude) templates and `HTMLMinifier`, a relay for [html-minifier](https://www.npmjs.com/package/html-minifier) options | ||
```javascript | ||
// defaults | ||
var config = { | ||
include: false, | ||
HTMLMinifier: { | ||
collapseWhitespace: true, | ||
removeComments: true | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9116
145
39