@modern-js/plugin-tailwindcss 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/cli.js +130 -158
- package/dist/cjs/design-token/cli/index.js +93 -111
- package/dist/cjs/design-token/index.js +26 -36
- package/dist/cjs/design-token/postcss-plugin/index.js +8 -26
- package/dist/cjs/design-token/runtime/index.js +27 -37
- package/dist/cjs/design-token/runtime/plugin.js +90 -52
- package/dist/cjs/index.js +13 -34
- package/dist/cjs/tailwind.js +33 -52
- package/dist/cjs/types.js +4 -15
- package/dist/cjs/utils.js +36 -49
- package/dist/esm/cli.js +264 -253
- package/dist/esm/design-token/cli/index.js +112 -113
- package/dist/esm/design-token/index.js +1 -2
- package/dist/esm/design-token/postcss-plugin/index.js +17 -17
- package/dist/esm/design-token/runtime/index.js +1 -2
- package/dist/esm/design-token/runtime/plugin.js +71 -71
- package/dist/esm/index.js +1 -2
- package/dist/esm/tailwind.js +88 -76
- package/dist/esm/types.js +1 -1
- package/dist/esm/utils.js +183 -177
- package/dist/esm-node/cli.js +109 -137
- package/dist/esm-node/design-token/cli/index.js +85 -94
- package/dist/esm-node/design-token/index.js +1 -4
- package/dist/esm-node/design-token/postcss-plugin/index.js +1 -6
- package/dist/esm-node/design-token/runtime/index.js +1 -4
- package/dist/esm-node/design-token/runtime/plugin.js +29 -18
- package/dist/esm-node/index.js +1 -4
- package/dist/esm-node/tailwind.js +24 -27
- package/dist/esm-node/types.js +1 -0
- package/dist/esm-node/utils.js +19 -18
- package/package.json +15 -11
package/dist/esm/utils.js
CHANGED
@@ -1,194 +1,200 @@
|
|
1
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
try {
|
3
|
+
var info = gen[key](arg);
|
4
|
+
var value = info.value;
|
5
|
+
} catch (error) {
|
6
|
+
reject(error);
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
if (info.done) {
|
10
|
+
resolve(value);
|
11
|
+
} else {
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
13
|
+
}
|
14
14
|
}
|
15
|
-
function
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
function _async_to_generator(fn) {
|
16
|
+
return function() {
|
17
|
+
var self = this, args = arguments;
|
18
|
+
return new Promise(function(resolve, reject) {
|
19
|
+
var gen = fn.apply(self, args);
|
20
|
+
function _next(value) {
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
22
|
+
}
|
23
|
+
function _throw(err) {
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
25
|
+
}
|
26
|
+
_next(void 0);
|
27
|
+
});
|
28
|
+
};
|
29
29
|
}
|
30
|
-
var __generator =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
var __generator = function(thisArg, body) {
|
31
|
+
var f, y, t, g, _ = {
|
32
|
+
label: 0,
|
33
|
+
sent: function() {
|
34
|
+
if (t[0] & 1)
|
35
|
+
throw t[1];
|
36
|
+
return t[1];
|
37
|
+
},
|
38
|
+
trys: [],
|
39
|
+
ops: []
|
40
|
+
};
|
41
|
+
return g = {
|
42
|
+
next: verb(0),
|
43
|
+
"throw": verb(1),
|
44
|
+
"return": verb(2)
|
45
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
46
|
+
return this;
|
47
|
+
}), g;
|
48
|
+
function verb(n) {
|
49
|
+
return function(v) {
|
50
|
+
return step([
|
51
|
+
n,
|
52
|
+
v
|
53
|
+
]);
|
39
54
|
};
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
break;
|
68
|
-
case 4:
|
69
|
-
_.label++;
|
70
|
-
return {
|
71
|
-
value: op[1],
|
72
|
-
done: false
|
73
|
-
};
|
74
|
-
case 5:
|
75
|
-
_.label++;
|
76
|
-
y = op[1];
|
77
|
-
op = [
|
78
|
-
0
|
79
|
-
];
|
80
|
-
continue;
|
81
|
-
case 7:
|
82
|
-
op = _.ops.pop();
|
83
|
-
_.trys.pop();
|
84
|
-
continue;
|
85
|
-
default:
|
86
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
87
|
-
_ = 0;
|
88
|
-
continue;
|
89
|
-
}
|
90
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
91
|
-
_.label = op[1];
|
92
|
-
break;
|
93
|
-
}
|
94
|
-
if (op[0] === 6 && _.label < t[1]) {
|
95
|
-
_.label = t[1];
|
96
|
-
t = op;
|
97
|
-
break;
|
98
|
-
}
|
99
|
-
if (t && _.label < t[2]) {
|
100
|
-
_.label = t[2];
|
101
|
-
_.ops.push(op);
|
102
|
-
break;
|
103
|
-
}
|
104
|
-
if (t[2]) _.ops.pop();
|
105
|
-
_.trys.pop();
|
106
|
-
continue;
|
107
|
-
}
|
108
|
-
op = body.call(thisArg, _);
|
109
|
-
} catch (e) {
|
55
|
+
}
|
56
|
+
function step(op) {
|
57
|
+
if (f)
|
58
|
+
throw new TypeError("Generator is already executing.");
|
59
|
+
while (_)
|
60
|
+
try {
|
61
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
62
|
+
return t;
|
63
|
+
if (y = 0, t)
|
64
|
+
op = [
|
65
|
+
op[0] & 2,
|
66
|
+
t.value
|
67
|
+
];
|
68
|
+
switch (op[0]) {
|
69
|
+
case 0:
|
70
|
+
case 1:
|
71
|
+
t = op;
|
72
|
+
break;
|
73
|
+
case 4:
|
74
|
+
_.label++;
|
75
|
+
return {
|
76
|
+
value: op[1],
|
77
|
+
done: false
|
78
|
+
};
|
79
|
+
case 5:
|
80
|
+
_.label++;
|
81
|
+
y = op[1];
|
110
82
|
op = [
|
111
|
-
|
112
|
-
e
|
83
|
+
0
|
113
84
|
];
|
114
|
-
|
115
|
-
|
116
|
-
|
85
|
+
continue;
|
86
|
+
case 7:
|
87
|
+
op = _.ops.pop();
|
88
|
+
_.trys.pop();
|
89
|
+
continue;
|
90
|
+
default:
|
91
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
92
|
+
_ = 0;
|
93
|
+
continue;
|
94
|
+
}
|
95
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
96
|
+
_.label = op[1];
|
97
|
+
break;
|
98
|
+
}
|
99
|
+
if (op[0] === 6 && _.label < t[1]) {
|
100
|
+
_.label = t[1];
|
101
|
+
t = op;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
if (t && _.label < t[2]) {
|
105
|
+
_.label = t[2];
|
106
|
+
_.ops.push(op);
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
if (t[2])
|
110
|
+
_.ops.pop();
|
111
|
+
_.trys.pop();
|
112
|
+
continue;
|
117
113
|
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
114
|
+
op = body.call(thisArg, _);
|
115
|
+
} catch (e) {
|
116
|
+
op = [
|
117
|
+
6,
|
118
|
+
e
|
119
|
+
];
|
120
|
+
y = 0;
|
121
|
+
} finally {
|
122
|
+
f = t = 0;
|
123
|
+
}
|
124
|
+
if (op[0] & 5)
|
125
|
+
throw op[1];
|
126
|
+
return {
|
127
|
+
value: op[0] ? op[1] : void 0,
|
128
|
+
done: true
|
129
|
+
};
|
130
|
+
}
|
124
131
|
};
|
125
132
|
import path from "path";
|
126
133
|
import { fs } from "@modern-js/utils";
|
127
|
-
var template = function(configPath) {
|
128
|
-
|
134
|
+
export var template = function(configPath) {
|
135
|
+
return "\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n}\nconst modernConfig = _interopRequireDefault(require('".concat(configPath, "')).default;\n\nconst theme =\n modernConfig && modernConfig.source && modernConfig.source.designSystem\n ? modernConfig.source.designSystem\n : {};\nconst tailwindcss =\n modernConfig && modernConfig.tools && modernConfig.tools.tailwindcss\n ? modernConfig.tools.tailwindcss\n : {};\n\nmodule.exports = {\n theme,\n ...tailwindcss,\n};\n");
|
129
136
|
};
|
130
137
|
var TWIN_MACRO_NAME = "twin.macro";
|
131
|
-
var checkTwinMacroExist = function() {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
});
|
138
|
+
export var checkTwinMacroExist = function() {
|
139
|
+
var _ref = _async_to_generator(function(appDirectory) {
|
140
|
+
var packageJson;
|
141
|
+
return __generator(this, function(_state) {
|
142
|
+
switch (_state.label) {
|
143
|
+
case 0:
|
144
|
+
return [
|
145
|
+
4,
|
146
|
+
fs.readJSON(path.join(appDirectory, "package.json"), {
|
147
|
+
throws: false
|
148
|
+
})
|
149
|
+
];
|
150
|
+
case 1:
|
151
|
+
packageJson = _state.sent() || {};
|
152
|
+
return [
|
153
|
+
2,
|
154
|
+
Boolean(typeof packageJson.dependencies === "object" && packageJson.dependencies[TWIN_MACRO_NAME] || typeof packageJson.devDependencies === "object" && packageJson.devDependencies[TWIN_MACRO_NAME])
|
155
|
+
];
|
156
|
+
}
|
151
157
|
});
|
152
|
-
|
153
|
-
|
154
|
-
|
158
|
+
});
|
159
|
+
return function checkTwinMacroExist2(appDirectory) {
|
160
|
+
return _ref.apply(this, arguments);
|
161
|
+
};
|
155
162
|
}();
|
156
|
-
var getTwinMacroMajorVersion = function(appDirectory) {
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
163
|
+
export var getTwinMacroMajorVersion = function(appDirectory) {
|
164
|
+
try {
|
165
|
+
var pkgJsonPath = require.resolve("".concat(TWIN_MACRO_NAME, "/package.json"), {
|
166
|
+
paths: [
|
167
|
+
appDirectory
|
168
|
+
]
|
169
|
+
});
|
170
|
+
var version = require(pkgJsonPath).version;
|
171
|
+
return Number(version.split(".")[0]);
|
172
|
+
} catch (err) {
|
173
|
+
return null;
|
174
|
+
}
|
168
175
|
};
|
169
|
-
function getTailwindPath(appDirectory) {
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
176
|
+
export function getTailwindPath(appDirectory) {
|
177
|
+
try {
|
178
|
+
return require.resolve("tailwindcss", {
|
179
|
+
paths: [
|
180
|
+
appDirectory,
|
181
|
+
__dirname
|
182
|
+
]
|
183
|
+
});
|
184
|
+
} catch (err) {
|
185
|
+
return "tailwindcss";
|
186
|
+
}
|
180
187
|
}
|
181
|
-
function getTailwindVersion(appDirectory) {
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
188
|
+
export function getTailwindVersion(appDirectory) {
|
189
|
+
try {
|
190
|
+
var packageJsonPath = require.resolve("tailwindcss/package.json", {
|
191
|
+
paths: [
|
192
|
+
appDirectory,
|
193
|
+
__dirname
|
194
|
+
]
|
195
|
+
});
|
196
|
+
return require(packageJsonPath).version.split(".")[0];
|
197
|
+
} catch (err) {
|
198
|
+
return "3";
|
199
|
+
}
|
193
200
|
}
|
194
|
-
export { checkTwinMacroExist, getTailwindPath, getTailwindVersion, getTwinMacroMajorVersion, template };
|
package/dist/esm-node/cli.js
CHANGED
@@ -1,158 +1,130 @@
|
|
1
1
|
import path from "path";
|
2
|
-
import {
|
3
|
-
PLUGIN_SCHEMAS,
|
4
|
-
fs,
|
5
|
-
CONFIG_CACHE_DIR,
|
6
|
-
globby,
|
7
|
-
nanoid,
|
8
|
-
slash
|
9
|
-
} from "@modern-js/utils";
|
2
|
+
import { PLUGIN_SCHEMAS, fs, CONFIG_CACHE_DIR, globby, nanoid, slash } from "@modern-js/utils";
|
10
3
|
import designTokenPlugin from "./design-token/cli";
|
11
4
|
import { getTailwindConfig } from "./tailwind";
|
12
|
-
import {
|
13
|
-
template,
|
14
|
-
checkTwinMacroExist,
|
15
|
-
getTailwindPath,
|
16
|
-
getTailwindVersion,
|
17
|
-
getTwinMacroMajorVersion
|
18
|
-
} from "./utils";
|
5
|
+
import { template, checkTwinMacroExist, getTailwindPath, getTailwindVersion, getTwinMacroMajorVersion } from "./utils";
|
19
6
|
const supportCssInJsLibrary = "styled-components";
|
20
|
-
const getRandomTwConfigFileName = (internalDirectory) => {
|
21
|
-
return slash(
|
22
|
-
path.join(
|
23
|
-
internalDirectory,
|
24
|
-
`tailwind.config.${Date.now()}.${nanoid()}.js`
|
25
|
-
)
|
26
|
-
);
|
7
|
+
export const getRandomTwConfigFileName = (internalDirectory) => {
|
8
|
+
return slash(path.join(internalDirectory, `tailwind.config.${Date.now()}.${nanoid()}.js`));
|
27
9
|
};
|
28
|
-
|
10
|
+
export default ({ pluginName } = {
|
29
11
|
pluginName: "@modern-js/plugin-tailwindcss"
|
30
|
-
}) =>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
path.join(appDirectory, CONFIG_CACHE_DIR, "*.cjs")
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
internalTwConfigPath,
|
71
|
-
template(files[files.length - 1]),
|
72
|
-
"utf-8"
|
73
|
-
);
|
12
|
+
}) => {
|
13
|
+
return {
|
14
|
+
name: "@modern-js/plugin-tailwindcss",
|
15
|
+
// support designSystem.supportStyledComponents
|
16
|
+
usePlugins: [
|
17
|
+
designTokenPlugin({
|
18
|
+
pluginName
|
19
|
+
})
|
20
|
+
],
|
21
|
+
setup: async (api) => {
|
22
|
+
const { appDirectory, internalDirectory } = api.useAppContext();
|
23
|
+
let internalTwConfigPath = "";
|
24
|
+
const haveTwinMacro = await checkTwinMacroExist(appDirectory);
|
25
|
+
const tailwindPath = getTailwindPath(appDirectory);
|
26
|
+
const tailwindVersion = getTailwindVersion(appDirectory);
|
27
|
+
const defaultContent = [
|
28
|
+
"./config/html/**/*.html",
|
29
|
+
"./config/html/**/*.ejs",
|
30
|
+
"./config/html/**/*.hbs",
|
31
|
+
"./src/**/*.js",
|
32
|
+
"./src/**/*.jsx",
|
33
|
+
"./src/**/*.ts",
|
34
|
+
"./src/**/*.tsx",
|
35
|
+
// about storybook
|
36
|
+
"./storybook/**/*"
|
37
|
+
];
|
38
|
+
return {
|
39
|
+
prepare() {
|
40
|
+
if (haveTwinMacro) {
|
41
|
+
const twinMajorVersion = getTwinMacroMajorVersion(appDirectory);
|
42
|
+
const useConfigPath = twinMajorVersion && twinMajorVersion < 3;
|
43
|
+
if (useConfigPath) {
|
44
|
+
internalTwConfigPath = getRandomTwConfigFileName(internalDirectory);
|
45
|
+
const globPattern = slash(path.join(appDirectory, CONFIG_CACHE_DIR, "*.cjs"));
|
46
|
+
const files = globby.sync(globPattern, {
|
47
|
+
absolute: true
|
48
|
+
});
|
49
|
+
if (files.length > 0) {
|
50
|
+
fs.writeFileSync(internalTwConfigPath, template(files[files.length - 1]), "utf-8");
|
51
|
+
}
|
74
52
|
}
|
75
53
|
}
|
76
|
-
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
tailwindConfig = getTailwindConfig(
|
88
|
-
tailwindVersion,
|
89
|
-
(_a = modernConfig == null ? void 0 : modernConfig.tools) == null ? void 0 : _a.tailwindcss,
|
90
|
-
(_b = modernConfig == null ? void 0 : modernConfig.source) == null ? void 0 : _b.designSystem,
|
91
|
-
{
|
54
|
+
},
|
55
|
+
validateSchema() {
|
56
|
+
return PLUGIN_SCHEMAS["@modern-js/plugin-tailwindcss"];
|
57
|
+
},
|
58
|
+
config() {
|
59
|
+
let tailwindConfig;
|
60
|
+
const initTailwindConfig = () => {
|
61
|
+
if (!tailwindConfig) {
|
62
|
+
var _modernConfig_tools, _modernConfig_source;
|
63
|
+
const modernConfig = api.useResolvedConfigContext();
|
64
|
+
tailwindConfig = getTailwindConfig(tailwindVersion, modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_tools = modernConfig.tools) === null || _modernConfig_tools === void 0 ? void 0 : _modernConfig_tools.tailwindcss, modernConfig === null || modernConfig === void 0 ? void 0 : (_modernConfig_source = modernConfig.source) === null || _modernConfig_source === void 0 ? void 0 : _modernConfig_source.designSystem, {
|
92
65
|
pureConfig: {
|
93
66
|
content: defaultContent
|
94
67
|
}
|
95
|
-
}
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
postcss: (config) => {
|
104
|
-
initTailwindConfig();
|
105
|
-
const tailwindPlugin = require(tailwindPath)(tailwindConfig);
|
106
|
-
if (Array.isArray(config.postcssOptions.plugins)) {
|
107
|
-
config.postcssOptions.plugins.push(tailwindPlugin);
|
108
|
-
} else {
|
109
|
-
config.postcssOptions.plugins = [tailwindPlugin];
|
110
|
-
}
|
111
|
-
},
|
112
|
-
babel(_, { addPlugins }) {
|
113
|
-
if (haveTwinMacro) {
|
68
|
+
});
|
69
|
+
}
|
70
|
+
};
|
71
|
+
return {
|
72
|
+
tools: {
|
73
|
+
// TODO: Add interface about postcss config
|
74
|
+
// TODO: In module project, also is called, but should not be called.
|
75
|
+
postcss: (config) => {
|
114
76
|
initTailwindConfig();
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
77
|
+
const tailwindPlugin = require(tailwindPath)(tailwindConfig);
|
78
|
+
if (Array.isArray(config.postcssOptions.plugins)) {
|
79
|
+
config.postcssOptions.plugins.push(tailwindPlugin);
|
80
|
+
} else {
|
81
|
+
config.postcssOptions.plugins = [
|
82
|
+
tailwindPlugin
|
83
|
+
];
|
84
|
+
}
|
85
|
+
},
|
86
|
+
babel(_, { addPlugins }) {
|
87
|
+
if (haveTwinMacro) {
|
88
|
+
initTailwindConfig();
|
89
|
+
addPlugins([
|
90
|
+
[
|
91
|
+
require.resolve("babel-plugin-macros"),
|
92
|
+
{
|
93
|
+
twin: {
|
94
|
+
preset: supportCssInJsLibrary,
|
95
|
+
config: internalTwConfigPath || tailwindConfig
|
96
|
+
}
|
122
97
|
}
|
123
|
-
|
124
|
-
]
|
125
|
-
|
98
|
+
]
|
99
|
+
]);
|
100
|
+
}
|
126
101
|
}
|
127
102
|
}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
const tailwindConfig = getTailwindConfig(
|
135
|
-
tailwindVersion,
|
136
|
-
config.style.tailwindCss,
|
137
|
-
designSystem,
|
138
|
-
{
|
103
|
+
};
|
104
|
+
},
|
105
|
+
beforeBuildTask(config) {
|
106
|
+
const modernConfig = api.useResolvedConfigContext();
|
107
|
+
const { designSystem } = modernConfig;
|
108
|
+
const tailwindConfig = getTailwindConfig(tailwindVersion, config.style.tailwindCss, designSystem, {
|
139
109
|
pureConfig: {
|
140
110
|
content: defaultContent
|
141
111
|
}
|
112
|
+
});
|
113
|
+
const tailwindPlugin = require(tailwindPath)(tailwindConfig);
|
114
|
+
if (Array.isArray(config.style.postcss.plugins)) {
|
115
|
+
config.style.postcss.plugins.push(tailwindPlugin);
|
116
|
+
} else {
|
117
|
+
config.style.postcss.plugins = [
|
118
|
+
tailwindPlugin
|
119
|
+
];
|
142
120
|
}
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
config.
|
147
|
-
|
148
|
-
config.style.postcss.plugins = [tailwindPlugin];
|
121
|
+
return config;
|
122
|
+
},
|
123
|
+
modifyLibuild(config, next) {
|
124
|
+
config.transformCache = false;
|
125
|
+
return next(config);
|
149
126
|
}
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
});
|
155
|
-
export {
|
156
|
-
cli_default as default,
|
157
|
-
getRandomTwConfigFileName
|
127
|
+
};
|
128
|
+
}
|
129
|
+
};
|
158
130
|
};
|