You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 15, 2023. It is now read-only.
> Preprocessor for converting HTML files to JS strings.
3
+
> Preprocessor for converting HTML files into JS strings.
4
+
5
+
*Note:* If you are using [AngularJS](http://angularjs.org/), check out [karma-ng-html2js-preprocessor](https://github.com/karma-runner/karma-ng-html2js-preprocessor).
6
+
7
+
## Installation
8
+
9
+
**This plugin ships with Karma by default, so you don't need to install it, it should just work ;-)**
10
+
11
+
The easiest way is to keep `karma-html2js-preprocessor` as a devDependency in your `package.json`.
12
+
```json
13
+
{
14
+
"devDependencies": {
15
+
"karma": "~0.9",
16
+
"karma-html2js-preprocessor": "~0.0.1"
17
+
}
18
+
}
19
+
```
20
+
21
+
You can simple do it by:
22
+
```bash
23
+
npm install karma-html2js-preprocessor --save-dev
24
+
```
25
+
26
+
## Configuration
27
+
Following code shows the default configuration...
28
+
```js
29
+
// karma.conf.js
30
+
module.exports=function(config) {
31
+
config.set({
32
+
preprocessors: {
33
+
'**/*.html': ['html2js']
34
+
},
35
+
36
+
files: [
37
+
'*.js',
38
+
'*.html'
39
+
]
40
+
});
41
+
};
42
+
```
43
+
44
+
## How does it work ?
45
+
46
+
This preprocessor converts HTML files into JS strings and publishes them in the global `window.__html__`, so that you can use these for testing DOM operations.
0 commit comments