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