https://github.com/dsalvagni/karma-underscore-template-preprocessor
Karma preprocessor for underscore templates.
https://github.com/dsalvagni/karma-underscore-template-preprocessor
karma karma-preprocessor underscore
Last synced: about 2 months ago
JSON representation
Karma preprocessor for underscore templates.
- Host: GitHub
- URL: https://github.com/dsalvagni/karma-underscore-template-preprocessor
- Owner: dsalvagni
- License: mit
- Created: 2019-04-03T08:44:11.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T21:14:45.000Z (about 4 years ago)
- Last Synced: 2025-02-09T07:22:55.141Z (3 months ago)
- Topics: karma, karma-preprocessor, underscore
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# karma-underscore-template-preprocessor
Enables support the underscore.js template system.
# Usage
```
npm install karma-underscore-template-preprocessor --save-dev
```karma.conf.js
```
files: ["underscore.min.js","**/*.jst"],
preprocessors: {
"**/*.jst": ["underscoreTemplate"]
},underscoreTemplatePreprocessor: {
beforeScript: "window.Namespace = window.Namespace || {}; Namespace.templates = Namespace.templates || {};",
globalTemplateVariable: "Namespace.templates"
},
````globalTemplateVariable` will set the global variable that's used to hold your compiled templates.
`beforeScript` will be execute before compiling each template file.# Result on your test files
For a given template file locate in: `folder/templates/meeting/item.jst` > `Namespace.templates.meetingitem()`;
For a given template file locate in: `folder/templates/meeting/Item.jst` > `Namespace.templates.meetingItem()`;
For a given templatee located on template root folder: `folder/templates/item.jst` > `Namespace.templates.item()`;