Skip to content

Commit 46745ee

Browse files
authored
Create README.md
1 parent 098610d commit 46745ee

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# vsts-coverage-styles
2+
3+
This package helps to convert the external css files linked in an HTML into an internal style i.e., by injecting in HTML using <style> tag in the document head.
4+
It follows the same order while injecting CSS back in the HTML.
5+
6+
It doesn't do anything else, so it is as simple and fast as it can.
7+
8+
install using ``` npm install vsts-coverage-styles --save ```
9+
10+
Following is how you can consume the package from the nodejs file.
11+
12+
The override css allows you to fix the glitches due to VSTS stripping :after & :before selectors, images & charsets
13+
14+
```
15+
/**
16+
* Vsts test coverage view doesn't load external CSS due to security reasons.
17+
* So we are converting all external css files to internal <style> tags using vsts-coverage-styles (node module).
18+
* Fix all UI issues due to VSTS stripping :after & :before selectors, images & charsets
19+
*/
20+
const vstsCoverageStyles = require('vsts-coverage-styles').VstsCoverageStyles;
21+
const overrideCss = '.status-line { clear:both;} ' +
22+
'.coverage .line-count, .coverage .line-coverage, ' +
23+
'.coverage .text .prettyprint {font-size:12px !important; ' +
24+
'line-height:1.2 !important;font-family:Consolas, "Liberation Mono", Menlo, Courier, monospace !important;}' +
25+
'.coverage .line-count{max-width:40px;padding-right:25px !important;} ' +
26+
'.coverage .line-coverage{max-width:45px;}' +
27+
'.coverage .line-coverage .cline-any{padding-right:25px !important;}' +
28+
'.coverage-summary{font-size:small;}';
29+
30+
// Default Options
31+
vstsCoverageStyles({
32+
coverageDir: './coverage',
33+
pattern: '/**/*.html',
34+
fileEncoding: 'utf8',
35+
minifyOptions: {
36+
37+
},
38+
extraCss: overrideCss,
39+
preProcessFn: function (html) {
40+
return html.replace(new RegExp('×', 'g'), 'x');
41+
},
42+
postProcessFn: function(html) {
43+
return html;
44+
}
45+
});```
46+

0 commit comments

Comments
 (0)