/
githubmirror
/
tailwindcss
Обзор
Документация
Войти
/
githubmirror
/
tailwindcss
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/@tailwindcss-cli/src/index.ts
82 строки
2 KB
Robin Malfait
Add `--poll` option to `@tailwindcss/cli` (#20297)
01 июл 2026, 22:25
Не верифицирован
01 июл 2026, 22:25
39656f7
Код
Авторство
О чём код?
#!/usr/bin/env node import { args, type Arg } from './utils/args' import * as build from './commands/build' import * as canonicalize from './commands/canonicalize' import { help } from './commands/help' const sharedOptions = { '--help': { type: 'boolean', description: 'Display usage information', alias: '-h' }, } satisfies Arg function buildUsage(command = 'tailwindcss') { return `${command} [--input input.css] [--output output.css] [--watch] [--poll=ms] [options…]` } function rootHelp({ invalid }: { invalid?: string } = {}) { help({ invalid, usage: [buildUsage('tailwindcss'), buildUsage('tailwindcss build'), canonicalize.usage()], commands: { build: 'Build your CSS', canonicalize: 'Canonicalize candidate lists', }, options: { ...build.options(), ...sharedOptions }, }) } async function run() { let argv = process.argv.slice(2) let command = argv[0] let rootFlags = args({ ...build.options(), ...sharedOptions }, argv) if (command === 'build') { let flags = args({ ...build.options(), ...sharedOptions }, argv.slice(1)) if ((process.stdout.isTTY && argv.length === 1) || flags['--help']) { help({ usage: [buildUsage('tailwindcss build')], options: { ...build.options(), ...sharedOptions }, }) process.exit(0) } await build.handle(flags) return } if (command === 'canonicalize') { let result = await canonicalize.runCommandLine({ argv: argv.slice(1) }) if (result.stdout.length > 0) { process.stdout.write(`${result.stdout}\n`) } if (result.stderr.length > 0) { process.stderr.write(`${result.stderr}\n`) } process.exitCode = result.exitCode return } if ((process.stdout.isTTY && command === undefined) || rootFlags['--help']) { rootHelp() process.exit(0) } if (command && !command.startsWith('-')) { rootHelp({ invalid: command }) process.exit(1) } let flags = args({ ...build.options(), ...sharedOptions, }) await build.handle(flags) } await run()