1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = wrapInClass;
|
5 |
|
6 | var _commonTags = require("common-tags");
|
7 |
|
8 | function wrapInClass(text) {
|
9 | const imports = [];
|
10 | let match;
|
11 | const rImports = /@import.*?(?:$|;)/g;
|
12 |
|
13 | while (match = rImports.exec(text)) {
|
14 | imports.push(match[0]);
|
15 | }
|
16 |
|
17 | text = text.replace(rImports, '');
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | let val = _commonTags.stripIndents`
|
25 | .cls1 { /*!*/ }
|
26 | .cls2 {
|
27 | composes: cls1;
|
28 |
|
29 | ${text.trim()}
|
30 | }`;
|
31 | if (imports.length) val = `${imports.join('\n')}\n${val}`;
|
32 | return val;
|
33 | } |
\ | No newline at end of file |