karma-handlebars-preprocessor
Advanced tools
Comparing version 0.2.0 to 0.3.0
19
index.js
@@ -32,8 +32,15 @@ var handlebars = require('handlebars'); | ||
try { | ||
processed = "(function() {" + templates + " = " + templates + " || {};" + | ||
templates + "['" + template + "'] = Handlebars.template(" + | ||
handlebars.precompile(content) + ");})();"; | ||
} catch (e) { | ||
log.error('%s\n at %s', e.message, file.originalPath); | ||
if(config.amd) { | ||
processed = "define(['handlebars'], function(Handlebars) {\n" + | ||
" return Handlebars.template(" + handlebars.precompile(content) + ");\n" + | ||
"});"; | ||
} else { | ||
try { | ||
processed = "(function() {" + templates + " = " + templates + " || {};" + | ||
templates + "['" + template + "'] = Handlebars.template(" + | ||
handlebars.precompile(content) + ");})();"; | ||
} catch (e) { | ||
log.error('%s\n at %s', e.message, file.originalPath); | ||
} | ||
} | ||
@@ -40,0 +47,0 @@ |
{ | ||
"name": "karma-handlebars-preprocessor", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A Karma plugin. Compile handlebars template on the fly.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -68,2 +68,13 @@ # karma-handlebars-preprocessor | ||
### AMD Based Template Configuration | ||
If you want to export your compiled templates as anonymous AMD modules, | ||
use the `amd` option in the config as shown below: | ||
```js | ||
handlebarsPreprocessor: { | ||
amd: true | ||
} | ||
``` | ||
## License | ||
@@ -70,0 +81,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
9307
72
85