tailwindcss 0.0.0-insiders.e2d5f21 → 0.0.0-insiders.e302ef1
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 +244 -3
- package/LICENSE +1 -2
- package/README.md +8 -4
- package/colors.js +2 -1
- package/defaultConfig.js +2 -1
- package/defaultTheme.js +2 -1
- package/lib/cli.js +123 -88
- package/lib/corePlugins.js +288 -360
- package/lib/css/preflight.css +4 -4
- package/lib/featureFlags.js +4 -5
- package/lib/index.js +12 -3
- package/lib/lib/cacheInvalidation.js +69 -0
- package/lib/lib/collapseAdjacentRules.js +14 -1
- package/lib/lib/collapseDuplicateDeclarations.js +52 -1
- package/lib/lib/defaultExtractor.js +44 -0
- package/lib/lib/evaluateTailwindFunctions.js +1 -1
- package/lib/lib/expandApplyAtRules.js +265 -60
- package/lib/lib/expandTailwindAtRules.js +63 -48
- package/lib/lib/generateRules.js +136 -34
- package/lib/lib/normalizeTailwindDirectives.js +10 -2
- package/lib/lib/partitionApplyAtRules.js +53 -0
- package/lib/lib/resolveDefaultsAtRules.js +30 -12
- package/lib/lib/setupContextUtils.js +137 -81
- package/lib/lib/setupTrackingContext.js +8 -7
- package/lib/lib/sharedState.js +38 -5
- package/{nesting → lib/postcss-plugins/nesting}/README.md +0 -0
- package/lib/postcss-plugins/nesting/index.js +17 -0
- package/lib/postcss-plugins/nesting/plugin.js +85 -0
- package/lib/processTailwindFeatures.js +10 -2
- package/lib/util/cloneNodes.js +12 -1
- package/lib/util/color.js +23 -8
- package/lib/util/createPlugin.js +1 -2
- package/lib/util/createUtilityPlugin.js +4 -8
- package/lib/util/dataTypes.js +4 -2
- package/lib/util/defaults.js +6 -0
- package/lib/util/flattenColorPalette.js +1 -3
- package/lib/util/log.js +10 -6
- package/lib/util/normalizeConfig.js +47 -15
- package/lib/util/normalizeScreens.js +6 -5
- package/lib/util/parseBoxShadowValue.js +44 -4
- package/lib/util/pluginUtils.js +6 -13
- package/lib/util/prefixSelector.js +4 -5
- package/lib/util/resolveConfig.js +48 -27
- package/lib/util/resolveConfigPath.js +1 -2
- package/lib/util/toColorValue.js +1 -2
- package/lib/util/toPath.js +6 -1
- package/lib/util/transformThemeValue.js +4 -8
- package/nesting/index.js +2 -12
- package/package.json +28 -33
- package/peers/index.js +3209 -4239
- package/plugin.js +2 -1
- package/resolveConfig.js +2 -1
- package/src/cli.js +62 -15
- package/src/corePlugins.js +212 -217
- package/src/css/preflight.css +4 -4
- package/src/featureFlags.js +3 -3
- package/src/index.js +14 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +16 -1
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/defaultExtractor.js +50 -0
- package/src/lib/evaluateTailwindFunctions.js +1 -1
- package/src/lib/expandApplyAtRules.js +285 -56
- package/src/lib/expandTailwindAtRules.js +75 -37
- package/src/lib/generateRules.js +121 -27
- package/src/lib/normalizeTailwindDirectives.js +7 -1
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/resolveDefaultsAtRules.js +35 -10
- package/src/lib/setupContextUtils.js +127 -45
- package/src/lib/setupTrackingContext.js +8 -7
- package/src/lib/sharedState.js +42 -4
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +12 -2
- package/src/util/cloneNodes.js +14 -1
- package/src/util/color.js +20 -7
- package/src/util/dataTypes.js +7 -5
- package/src/util/defaults.js +6 -0
- package/src/util/log.js +10 -6
- package/src/util/normalizeConfig.js +24 -3
- package/src/util/normalizeScreens.js +6 -3
- package/src/util/parseBoxShadowValue.js +51 -3
- package/src/util/pluginUtils.js +1 -1
- package/src/util/prefixSelector.js +7 -5
- package/src/util/resolveConfig.js +41 -1
- package/src/util/toPath.js +23 -1
- package/stubs/defaultConfig.stub.js +2 -2
- package/lib/lib/setupWatchingContext.js +0 -288
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -311
package/lib/cli.js
CHANGED
|
@@ -40,7 +40,26 @@ function formatNodes(root) {
|
|
|
40
40
|
root.first.raws.before = '';
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
async function outputFile(file, contents) {
|
|
44
|
+
if (_fs.default.existsSync(file) && await _fs.default.promises.readFile(file, 'utf8') === contents) {
|
|
45
|
+
return; // Skip writing the file
|
|
46
|
+
}
|
|
47
|
+
// Write the file
|
|
48
|
+
await _fs.default.promises.writeFile(file, contents, 'utf8');
|
|
49
|
+
}
|
|
50
|
+
function drainStdin() {
|
|
51
|
+
return new Promise((resolve, reject)=>{
|
|
52
|
+
let result = '';
|
|
53
|
+
process.stdin.on('data', (chunk)=>{
|
|
54
|
+
result += chunk;
|
|
55
|
+
});
|
|
56
|
+
process.stdin.on('end', ()=>resolve(result)
|
|
57
|
+
);
|
|
58
|
+
process.stdin.on('error', (err)=>reject(err)
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function help({ message , usage , commands: commands1 , options }) {
|
|
44
63
|
let indent = 2;
|
|
45
64
|
// Render header
|
|
46
65
|
console.log();
|
|
@@ -61,17 +80,16 @@ function help({ message , usage , commands , options }) {
|
|
|
61
80
|
}
|
|
62
81
|
}
|
|
63
82
|
// Render commands
|
|
64
|
-
if (
|
|
83
|
+
if (commands1 && commands1.length > 0) {
|
|
65
84
|
console.log();
|
|
66
85
|
console.log('Commands:');
|
|
67
|
-
for (let
|
|
68
|
-
console.log(' '.repeat(indent),
|
|
86
|
+
for (let command1 of commands1){
|
|
87
|
+
console.log(' '.repeat(indent), command1);
|
|
69
88
|
}
|
|
70
89
|
}
|
|
71
90
|
// Render options
|
|
72
91
|
if (options) {
|
|
73
|
-
let groupedOptions = {
|
|
74
|
-
};
|
|
92
|
+
let groupedOptions = {};
|
|
75
93
|
for (let [key, value] of Object.entries(options)){
|
|
76
94
|
if (typeof value === 'object') {
|
|
77
95
|
groupedOptions[key] = {
|
|
@@ -86,12 +104,12 @@ function help({ message , usage , commands , options }) {
|
|
|
86
104
|
}
|
|
87
105
|
console.log();
|
|
88
106
|
console.log('Options:');
|
|
89
|
-
for (let { flags , description , deprecated } of Object.values(groupedOptions)){
|
|
107
|
+
for (let { flags: flags1 , description , deprecated } of Object.values(groupedOptions)){
|
|
90
108
|
if (deprecated) continue;
|
|
91
|
-
if (
|
|
92
|
-
console.log(' '.repeat(indent + 4 /* 4 = "-i, ".length */ ),
|
|
109
|
+
if (flags1.length === 1) {
|
|
110
|
+
console.log(' '.repeat(indent + 4 /* 4 = "-i, ".length */ ), flags1.slice().reverse().join(', ').padEnd(20, ' '), description);
|
|
93
111
|
} else {
|
|
94
|
-
console.log(' '.repeat(indent),
|
|
112
|
+
console.log(' '.repeat(indent), flags1.slice().reverse().join(', ').padEnd(24, ' '), description);
|
|
95
113
|
}
|
|
96
114
|
}
|
|
97
115
|
}
|
|
@@ -110,7 +128,7 @@ function oneOf(...options) {
|
|
|
110
128
|
manualParsing: true
|
|
111
129
|
});
|
|
112
130
|
}
|
|
113
|
-
let
|
|
131
|
+
let commands = {
|
|
114
132
|
init: {
|
|
115
133
|
run: init,
|
|
116
134
|
args: {
|
|
@@ -187,31 +205,31 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
187
205
|
'tailwindcss [--input input.css] [--output output.css] [--watch] [options...]',
|
|
188
206
|
'tailwindcss init [--full] [--postcss] [options...]',
|
|
189
207
|
],
|
|
190
|
-
commands: Object.keys(
|
|
191
|
-
).map((
|
|
208
|
+
commands: Object.keys(commands).filter((command2)=>command2 !== 'build'
|
|
209
|
+
).map((command3)=>`${command3} [options]`
|
|
192
210
|
),
|
|
193
211
|
options: {
|
|
194
|
-
...
|
|
212
|
+
...commands.build.args,
|
|
195
213
|
...sharedFlags
|
|
196
214
|
}
|
|
197
215
|
});
|
|
198
216
|
process.exit(0);
|
|
199
217
|
}
|
|
200
|
-
let
|
|
218
|
+
let command = ((arg = '')=>arg.startsWith('-') ? undefined : arg
|
|
201
219
|
)(process.argv[2]) || 'build';
|
|
202
|
-
if (
|
|
203
|
-
if (_fs.default.existsSync(_path.default.resolve(
|
|
220
|
+
if (commands[command] === undefined) {
|
|
221
|
+
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
204
222
|
// TODO: Deprecate this in future versions
|
|
205
223
|
// Check if non-existing command, might be a file.
|
|
206
|
-
|
|
224
|
+
command = 'build';
|
|
207
225
|
} else {
|
|
208
226
|
help({
|
|
209
|
-
message: `Invalid command: ${
|
|
227
|
+
message: `Invalid command: ${command}`,
|
|
210
228
|
usage: [
|
|
211
229
|
'tailwindcss <command> [options]'
|
|
212
230
|
],
|
|
213
|
-
commands: Object.keys(
|
|
214
|
-
).map((
|
|
231
|
+
commands: Object.keys(commands).filter((command4)=>command4 !== 'build'
|
|
232
|
+
).map((command5)=>`${command5} [options]`
|
|
215
233
|
),
|
|
216
234
|
options: sharedFlags
|
|
217
235
|
});
|
|
@@ -219,11 +237,11 @@ if (commands1[command1] === undefined) {
|
|
|
219
237
|
}
|
|
220
238
|
}
|
|
221
239
|
// Execute command
|
|
222
|
-
let { args:
|
|
223
|
-
let
|
|
240
|
+
let { args: flags , run } = commands[command];
|
|
241
|
+
let args = (()=>{
|
|
224
242
|
try {
|
|
225
243
|
let result = (0, _arg).default(Object.fromEntries(Object.entries({
|
|
226
|
-
...
|
|
244
|
+
...flags,
|
|
227
245
|
...sharedFlags
|
|
228
246
|
}).filter(([_key, value])=>{
|
|
229
247
|
var ref;
|
|
@@ -240,23 +258,23 @@ let args1 = (()=>{
|
|
|
240
258
|
let flag = result['_'][i];
|
|
241
259
|
if (!flag.startsWith('-')) continue;
|
|
242
260
|
let flagName = flag;
|
|
243
|
-
let handler =
|
|
261
|
+
let handler = flags[flag];
|
|
244
262
|
// Resolve flagName & handler
|
|
245
263
|
while(typeof handler === 'string'){
|
|
246
264
|
flagName = handler;
|
|
247
|
-
handler =
|
|
265
|
+
handler = flags[handler];
|
|
248
266
|
}
|
|
249
267
|
if (!handler) continue;
|
|
250
|
-
let
|
|
268
|
+
let args1 = [];
|
|
251
269
|
let offset = i + 1;
|
|
252
270
|
// Parse args for current flag
|
|
253
271
|
while(result['_'][offset] && !result['_'][offset].startsWith('-')){
|
|
254
|
-
|
|
272
|
+
args1.push(result['_'][offset++]);
|
|
255
273
|
}
|
|
256
274
|
// Cleanup manually parsed flags + args
|
|
257
|
-
result['_'].splice(i, 1 +
|
|
275
|
+
result['_'].splice(i, 1 + args1.length);
|
|
258
276
|
// Set the resolved value in the `result` object
|
|
259
|
-
result[flagName] = handler.type(
|
|
277
|
+
result[flagName] = handler.type(args1.length === 0 ? undefined : args1.length === 1 ? args1[0] : args1, flagName);
|
|
260
278
|
}
|
|
261
279
|
// Ensure that the `command` is always the first argument in the `args`.
|
|
262
280
|
// This is important so that we don't have to check if a default command
|
|
@@ -264,8 +282,8 @@ let args1 = (()=>{
|
|
|
264
282
|
//
|
|
265
283
|
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
266
284
|
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
267
|
-
if (result['_'][0] !==
|
|
268
|
-
result['_'].unshift(
|
|
285
|
+
if (result['_'][0] !== command) {
|
|
286
|
+
result['_'].unshift(command);
|
|
269
287
|
}
|
|
270
288
|
return result;
|
|
271
289
|
} catch (err) {
|
|
@@ -282,14 +300,14 @@ let args1 = (()=>{
|
|
|
282
300
|
throw err;
|
|
283
301
|
}
|
|
284
302
|
})();
|
|
285
|
-
if (
|
|
303
|
+
if (args['--help']) {
|
|
286
304
|
help({
|
|
287
305
|
options: {
|
|
288
|
-
...
|
|
306
|
+
...flags,
|
|
289
307
|
...sharedFlags
|
|
290
308
|
},
|
|
291
309
|
usage: [
|
|
292
|
-
`tailwindcss ${
|
|
310
|
+
`tailwindcss ${command} [options]`
|
|
293
311
|
]
|
|
294
312
|
});
|
|
295
313
|
process.exit(0);
|
|
@@ -299,17 +317,17 @@ run();
|
|
|
299
317
|
function init() {
|
|
300
318
|
let messages = [];
|
|
301
319
|
var ref;
|
|
302
|
-
let tailwindConfigLocation = _path.default.resolve((ref =
|
|
320
|
+
let tailwindConfigLocation = _path.default.resolve((ref = args['_'][1]) !== null && ref !== void 0 ? ref : './tailwind.config.js');
|
|
303
321
|
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
|
304
322
|
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
|
305
323
|
} else {
|
|
306
|
-
let stubFile = _fs.default.readFileSync(
|
|
324
|
+
let stubFile = _fs.default.readFileSync(args['--full'] ? _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js') : _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js'), 'utf8');
|
|
307
325
|
// Change colors import
|
|
308
326
|
stubFile = stubFile.replace('../colors', 'tailwindcss/colors');
|
|
309
327
|
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, 'utf8');
|
|
310
328
|
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
|
311
329
|
}
|
|
312
|
-
if (
|
|
330
|
+
if (args['--postcss']) {
|
|
313
331
|
let postcssConfigLocation = _path.default.resolve('./postcss.config.js');
|
|
314
332
|
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
315
333
|
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
@@ -327,37 +345,35 @@ function init() {
|
|
|
327
345
|
}
|
|
328
346
|
}
|
|
329
347
|
async function build() {
|
|
330
|
-
let input =
|
|
331
|
-
let output =
|
|
332
|
-
let shouldWatch =
|
|
333
|
-
let includePostCss =
|
|
348
|
+
let input = args['--input'];
|
|
349
|
+
let output = args['--output'];
|
|
350
|
+
let shouldWatch = args['--watch'];
|
|
351
|
+
let includePostCss = args['--postcss'];
|
|
334
352
|
// TODO: Deprecate this in future versions
|
|
335
|
-
if (!input &&
|
|
353
|
+
if (!input && args['_'][1]) {
|
|
336
354
|
console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
|
|
337
|
-
input =
|
|
355
|
+
input = args['--input'] = args['_'][1];
|
|
338
356
|
}
|
|
339
|
-
if (input && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
340
|
-
console.error(`Specified input file ${
|
|
357
|
+
if (input && input !== '-' && !_fs.default.existsSync(input = _path.default.resolve(input))) {
|
|
358
|
+
console.error(`Specified input file ${args['--input']} does not exist.`);
|
|
341
359
|
process.exit(9);
|
|
342
360
|
}
|
|
343
|
-
if (
|
|
344
|
-
console.error(`Specified config file ${
|
|
361
|
+
if (args['--config'] && !_fs.default.existsSync(args['--config'] = _path.default.resolve(args['--config']))) {
|
|
362
|
+
console.error(`Specified config file ${args['--config']} does not exist.`);
|
|
345
363
|
process.exit(9);
|
|
346
364
|
}
|
|
347
|
-
let configPath =
|
|
365
|
+
let configPath = args['--config'] ? args['--config'] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
|
|
348
366
|
)(_path.default.resolve('./tailwind.config.js'));
|
|
349
367
|
async function loadPostCssPlugins() {
|
|
350
|
-
let customPostCssPath = typeof
|
|
368
|
+
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
|
|
351
369
|
let { plugins: configPlugins } = customPostCssPath ? await (async ()=>{
|
|
352
370
|
let file = _path.default.resolve(customPostCssPath);
|
|
353
371
|
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0.1/src/index.js
|
|
354
|
-
let { config ={
|
|
355
|
-
} } = await (0, _cosmiconfig).cosmiconfig('postcss').load(file);
|
|
372
|
+
let { config ={} } = await (0, _cosmiconfig).cosmiconfig('postcss').load(file);
|
|
356
373
|
if (typeof config === 'function') {
|
|
357
374
|
config = config();
|
|
358
375
|
} else {
|
|
359
|
-
config = Object.assign({
|
|
360
|
-
}, config);
|
|
376
|
+
config = Object.assign({}, config);
|
|
361
377
|
}
|
|
362
378
|
if (!config.plugins) {
|
|
363
379
|
config.plugins = [];
|
|
@@ -383,22 +399,27 @@ async function build() {
|
|
|
383
399
|
];
|
|
384
400
|
}
|
|
385
401
|
function resolveConfig() {
|
|
386
|
-
let config = configPath ? require(configPath) : {
|
|
387
|
-
|
|
388
|
-
let resolvedConfig = (0, _resolveConfig).default(config);
|
|
389
|
-
if (args1['--purge']) {
|
|
402
|
+
let config = configPath ? require(configPath) : {};
|
|
403
|
+
if (args['--purge']) {
|
|
390
404
|
_log.default.warn('purge-flag-deprecated', [
|
|
391
405
|
'The `--purge` flag has been deprecated.',
|
|
392
406
|
'Please use `--content` instead.',
|
|
393
407
|
]);
|
|
394
|
-
if (!
|
|
395
|
-
|
|
408
|
+
if (!args['--content']) {
|
|
409
|
+
args['--content'] = args['--purge'];
|
|
396
410
|
}
|
|
397
411
|
}
|
|
398
|
-
if (
|
|
399
|
-
|
|
412
|
+
if (args['--content']) {
|
|
413
|
+
let files = args['--content'].split(/(?<!{[^}]+),/);
|
|
414
|
+
let resolvedConfig = (0, _resolveConfig).default(config, {
|
|
415
|
+
content: {
|
|
416
|
+
files
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
resolvedConfig.content.files = files;
|
|
420
|
+
return resolvedConfig;
|
|
400
421
|
}
|
|
401
|
-
return
|
|
422
|
+
return (0, _resolveConfig).default(config);
|
|
402
423
|
}
|
|
403
424
|
function extractFileGlobs(config) {
|
|
404
425
|
return config.content.files.filter((file)=>{
|
|
@@ -457,17 +478,16 @@ async function build() {
|
|
|
457
478
|
let plugins = [
|
|
458
479
|
...beforePlugins,
|
|
459
480
|
tailwindPlugin,
|
|
460
|
-
!
|
|
481
|
+
!args['--minify'] && formatNodes,
|
|
461
482
|
...afterPlugins,
|
|
462
|
-
!
|
|
483
|
+
!args['--no-autoprefixer'] && (()=>{
|
|
463
484
|
// Try to load a local `autoprefixer` version first
|
|
464
485
|
try {
|
|
465
486
|
return require('autoprefixer');
|
|
466
|
-
} catch {
|
|
467
|
-
}
|
|
487
|
+
} catch {}
|
|
468
488
|
return (0, _indexJs).lazyAutoprefixer();
|
|
469
489
|
})(),
|
|
470
|
-
|
|
490
|
+
args['--minify'] && (()=>{
|
|
471
491
|
let options = {
|
|
472
492
|
preset: [
|
|
473
493
|
'default',
|
|
@@ -479,8 +499,7 @@ async function build() {
|
|
|
479
499
|
// Try to load a local `cssnano` version first
|
|
480
500
|
try {
|
|
481
501
|
return require('cssnano');
|
|
482
|
-
} catch {
|
|
483
|
-
}
|
|
502
|
+
} catch {}
|
|
484
503
|
return (0, _indexJs).lazyCssnano()(options);
|
|
485
504
|
})(),
|
|
486
505
|
].filter(Boolean);
|
|
@@ -499,10 +518,8 @@ async function build() {
|
|
|
499
518
|
return process.stdout.write(result.css);
|
|
500
519
|
}
|
|
501
520
|
return Promise.all([
|
|
502
|
-
|
|
503
|
-
),
|
|
504
|
-
result.map && _fs.default.writeFile(output + '.map', result.map.toString(), ()=>true
|
|
505
|
-
),
|
|
521
|
+
outputFile(output, result.css),
|
|
522
|
+
result.map && outputFile(output + '.map', result.map.toString()),
|
|
506
523
|
].filter(Boolean));
|
|
507
524
|
}).then(()=>{
|
|
508
525
|
let end = process.hrtime.bigint();
|
|
@@ -510,7 +527,18 @@ async function build() {
|
|
|
510
527
|
console.error('Done in', (end - start) / BigInt(1000000) + 'ms.');
|
|
511
528
|
});
|
|
512
529
|
}
|
|
513
|
-
let css1 =
|
|
530
|
+
let css1 = await (()=>{
|
|
531
|
+
// Piping in data, let's drain the stdin
|
|
532
|
+
if (input === '-') {
|
|
533
|
+
return drainStdin();
|
|
534
|
+
}
|
|
535
|
+
// Input file has been provided
|
|
536
|
+
if (input) {
|
|
537
|
+
return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
|
|
538
|
+
}
|
|
539
|
+
// No input file provided, fallback to default atrules
|
|
540
|
+
return '@tailwind base; @tailwind components; @tailwind utilities';
|
|
541
|
+
})();
|
|
514
542
|
return processCSS(css1);
|
|
515
543
|
}
|
|
516
544
|
let context = null;
|
|
@@ -541,17 +569,16 @@ async function build() {
|
|
|
541
569
|
let plugins = [
|
|
542
570
|
...beforePlugins,
|
|
543
571
|
'__TAILWIND_PLUGIN_POSITION__',
|
|
544
|
-
!
|
|
572
|
+
!args['--minify'] && formatNodes,
|
|
545
573
|
...afterPlugins,
|
|
546
|
-
!
|
|
574
|
+
!args['--no-autoprefixer'] && (()=>{
|
|
547
575
|
// Try to load a local `autoprefixer` version first
|
|
548
576
|
try {
|
|
549
577
|
return require('autoprefixer');
|
|
550
|
-
} catch {
|
|
551
|
-
}
|
|
578
|
+
} catch {}
|
|
552
579
|
return (0, _indexJs).lazyAutoprefixer();
|
|
553
580
|
})(),
|
|
554
|
-
|
|
581
|
+
args['--minify'] && (()=>{
|
|
555
582
|
let options = {
|
|
556
583
|
preset: [
|
|
557
584
|
'default',
|
|
@@ -563,8 +590,7 @@ async function build() {
|
|
|
563
590
|
// Try to load a local `cssnano` version first
|
|
564
591
|
try {
|
|
565
592
|
return require('cssnano');
|
|
566
|
-
} catch {
|
|
567
|
-
}
|
|
593
|
+
} catch {}
|
|
568
594
|
return (0, _indexJs).lazyCssnano()(options);
|
|
569
595
|
})(),
|
|
570
596
|
].filter(Boolean);
|
|
@@ -619,11 +645,9 @@ async function build() {
|
|
|
619
645
|
if (!output) {
|
|
620
646
|
return process.stdout.write(result.css);
|
|
621
647
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
),
|
|
625
|
-
result.map && _fs.default.writeFile(output + '.map', result.map.toString(), ()=>true
|
|
626
|
-
),
|
|
648
|
+
return Promise.all([
|
|
649
|
+
outputFile(output, result.css),
|
|
650
|
+
result.map && outputFile(output + '.map', result.map.toString()),
|
|
627
651
|
].filter(Boolean));
|
|
628
652
|
}).then(()=>{
|
|
629
653
|
let end = process.hrtime.bigint();
|
|
@@ -636,7 +660,18 @@ async function build() {
|
|
|
636
660
|
}
|
|
637
661
|
});
|
|
638
662
|
}
|
|
639
|
-
let css2 =
|
|
663
|
+
let css2 = await (()=>{
|
|
664
|
+
// Piping in data, let's drain the stdin
|
|
665
|
+
if (input === '-') {
|
|
666
|
+
return drainStdin();
|
|
667
|
+
}
|
|
668
|
+
// Input file has been provided
|
|
669
|
+
if (input) {
|
|
670
|
+
return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
|
|
671
|
+
}
|
|
672
|
+
// No input file provided, fallback to default atrules
|
|
673
|
+
return '@tailwind base; @tailwind components; @tailwind utilities';
|
|
674
|
+
})();
|
|
640
675
|
let result1 = await processCSS(css2);
|
|
641
676
|
env.DEBUG && console.timeEnd('Finished in');
|
|
642
677
|
return result1;
|