Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geyang/karma-text2js-preprocessor
karma preprocessor that turns text documents into strings. [angular module mode available]
https://github.com/geyang/karma-text2js-preprocessor
Last synced: about 2 months ago
JSON representation
karma preprocessor that turns text documents into strings. [angular module mode available]
- Host: GitHub
- URL: https://github.com/geyang/karma-text2js-preprocessor
- Owner: geyang
- License: mit
- Created: 2015-03-25T20:06:24.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-25T23:44:27.000Z (almost 10 years ago)
- Last Synced: 2024-04-14T15:11:52.097Z (9 months ago)
- Language: CoffeeScript
- Size: 102 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# karma-text2js-preprocessor
> Preprocessor for converting text files to javascript strings.
## Installation
The easiest way is to keep `karma-text2js-preprocessor` as a devDependency in your `package.json`.
```json
{
"devDependencies": {
"karma": "~0.10",
"karma-text2js-preprocessor": "~0.1"
}
}
```You can simple do it by:
```bash
npm install karma-text2js-preprocessor --save-dev
```## Configuration
```js
// karma.conf.js
module.exports = function(config) {
config.set({
preprocessors: {
'**/*.html': ['text2js']
},files: [
'*.js',
'*.html',
'*.html.ext',
// if you wanna load template files in nested directories, you must use this
'**/*.html'
],text2JsPreprocessor: {
// strip this from the file path
stripPrefix: 'public/',
stripSufix: '.ext',
// prepend this to the
prependPrefix: 'served/',// or define a custom transform function
cacheIdFromPath: function(filepath) {
return cacheId;
},// in angular mode, angular modules are created
angularMode: true,
// setting this option will create only a single module that contains templates
// from all the files, so you can load them all with module('foo')
moduleName: 'foo'
}
});
};
```----
For more information on Karma see the [homepage].
[homepage]: http://karma-runner.github.com