1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import * as csstree from 'css-tree';
|
8 |
|
9 | export as namespace csso;
|
10 | export const version: string;
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export function minify(source: string, options?: MinifyOptions & CompressOptions): Result;
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export function minifyBlock(source: string, options?: MinifyOptions & CompressOptions): Result;
|
24 |
|
25 | export const syntax: typeof csstree & {
|
26 | |
27 |
|
28 |
|
29 | compress(ast: csstree.CssNode, options?: CompressOptions): { ast: csstree.CssNode };
|
30 | };
|
31 |
|
32 | export interface Result {
|
33 | |
34 |
|
35 |
|
36 | css: string;
|
37 | |
38 |
|
39 |
|
40 | map: object | null;
|
41 | }
|
42 |
|
43 | export interface Usage {
|
44 | tags?: string[] | undefined;
|
45 | ids?: string[] | undefined;
|
46 | classes?: string[] | undefined;
|
47 | scopes?: string[][] | undefined;
|
48 | blacklist?:
|
49 | | {
|
50 | tags?: string[] | undefined;
|
51 | ids?: string[] | undefined;
|
52 | classes?: string[] | undefined;
|
53 | }
|
54 | | undefined;
|
55 | }
|
56 |
|
57 | export interface CompressOptions {
|
58 | |
59 |
|
60 |
|
61 |
|
62 | restructure?: boolean | undefined;
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 | forceMediaMerge?: boolean | undefined;
|
69 | |
70 |
|
71 |
|
72 |
|
73 | clone?: boolean | undefined;
|
74 | |
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | comments?: string | boolean | undefined;
|
82 | |
83 |
|
84 |
|
85 | usage?: Usage | undefined;
|
86 | |
87 |
|
88 |
|
89 | logger?: (() => void) | undefined;
|
90 | }
|
91 |
|
92 | export interface MinifyOptions {
|
93 | /**
|
94 | * Generate a source map when true.
|
95 | * @default false
|
96 | */
|
97 | sourceMap?: boolean | undefined;
|
98 | /**
|
99 | * Filename of input CSS, uses for source map generation.
|
100 | * @default '<unknown>'
|
101 | */
|
102 | filename?: string | undefined;
|
103 | /**
|
104 | * Output debug information to stderr.
|
105 | * @default false
|
106 | */
|
107 | debug?: boolean | undefined;
|
108 | /**
|
109 | * Called right after parse is run.
|
110 | */
|
111 | beforeCompress?: BeforeCompressFn | BeforeCompressFn[] | undefined;
|
112 | /**
|
113 | * Called right after compress() is run.
|
114 | */
|
115 | afterCompress?: AfterCompressFn | AfterCompressFn[] | undefined;
|
116 | restructure?: boolean | undefined;
|
117 | }
|
118 |
|
119 | export type BeforeCompressFn = (ast: object, options: CompressOptions) => void;
|
120 | export type AfterCompressFn = (compressResult: string, options: CompressOptions) => void;
|