forked from stephanrauh/ngx-extended-pdf-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-sass.ts
26 lines (20 loc) · 2.07 KB
/
compile-sass.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as fs from 'fs';
import * as sass from 'sass';
const options = { style: 'compressed' } as sass.Options<'sync'>;
const dark = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/pdf-dark-theme/colors.scss', options);
const light = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/pdf-light-theme/colors.scss', options);
const print = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/common/print.scss', options);
fs.writeFileSync('./projects/ngx-extended-pdf-viewer/src/lib/theme/pdf-dark-theme/colors-css.ts', cssToTs(dark.css + ' ' + print.css));
fs.writeFileSync('./projects/ngx-extended-pdf-viewer/src/lib/theme/pdf-light-theme/colors-css.ts', cssToTs(light.css + ' ' + print.css));
const acroformDefault = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/acroform-default-theme/pdf-acroform-default-colors.scss', options);
const acroformDark = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/acroform-dark-theme/pdf-acroform-dark-colors.scss', options);
const annotationLayerBuilder = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/common/annotation-layer-builder.scss', options);
const xfaLayerBuilder = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/common/xfa_layer_builder.scss', options);
const annotationEditorLayerBuilder = sass.compile('./projects/ngx-extended-pdf-viewer/src/lib/theme/common/annotation_editor_layer_builder.css', options);
const acroDarkCSS = [acroformDark.css, annotationLayerBuilder.css, xfaLayerBuilder.css, annotationEditorLayerBuilder.css].join(' ');
fs.writeFileSync('./projects/ngx-extended-pdf-viewer/src/lib/theme/acroform-dark-theme/pdf-acroform-dark-colors-css.ts', cssToTs(acroDarkCSS));
const acroLightCSS = [acroformDefault.css, annotationLayerBuilder.css, xfaLayerBuilder.css, annotationEditorLayerBuilder.css].join(' ');
fs.writeFileSync('./projects/ngx-extended-pdf-viewer/src/lib/theme/acroform-default-theme/pdf-acroform-default-colors-css.ts', cssToTs(acroLightCSS));
function cssToTs(css: string): string {
return `export const css=\`${css}\`;`;
}