Skip to content

Commit 0453d49

Browse files
committed
watch mode
1 parent 3f1db5f commit 0453d49

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

packages/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"storybook": "BROWSER=none storybook dev -p 6006",
9191
"build-storybook": "storybook build",
9292
"test-storybook": "test-storybook",
93-
"build-tw": "tailwindcss --input ./src/client/components/react-dev-overlay/ui/styles/tailwind.input.css --output ./src/client/components/react-dev-overlay/ui/styles/tailwind.output.css --minify",
93+
"build-tw": "tailwindcss --input ./src/client/components/react-dev-overlay/tailwind.input.css --output ./src/client/components/react-dev-overlay/ui/styles/tailwind.output.css --minify",
9494
"watch-tw": "pnpm build-tw --watch"
9595
},
9696
"taskr": {

packages/next/taskfile.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,7 +2392,12 @@ export async function ncc_https_proxy_agent(task, opts) {
23922392

23932393
export async function precompile(task, opts) {
23942394
await task.parallel(
2395-
['browser_polyfills', 'copy_ncced', 'copy_styled_jsx_assets'],
2395+
[
2396+
'browser_polyfills',
2397+
'copy_ncced',
2398+
'copy_styled_jsx_assets',
2399+
'inject_tailwind_styles',
2400+
],
23962401
opts
23972402
)
23982403

@@ -2829,13 +2834,7 @@ export async function diagnostics(task, opts) {
28292834

28302835
export async function build(task, opts) {
28312836
await task.serial(
2832-
[
2833-
'inject_tailwind_styles',
2834-
'precompile',
2835-
'compile',
2836-
'check_error_codes',
2837-
'generate_types',
2838-
],
2837+
['precompile', 'compile', 'check_error_codes', 'generate_types'],
28392838
opts
28402839
)
28412840
}
@@ -2877,11 +2876,18 @@ export async function check_error_codes(task, opts) {
28772876
}
28782877
}
28792878

2880-
export async function inject_tailwind_styles() {
2879+
export async function inject_tailwind_styles(task, opts) {
28812880
// Generate the production build of tailwind css file.
2882-
await execa.command('pnpm build-tw', {
2883-
stdio: 'inherit',
2884-
})
2881+
if (opts.dev) {
2882+
// If await, it blocks the subsequent tasks.
2883+
execa('pnpm', ['watch-tw'], {
2884+
stdio: 'inherit',
2885+
})
2886+
} else {
2887+
await execa('pnpm', ['build-tw'], {
2888+
stdio: 'inherit',
2889+
})
2890+
}
28852891

28862892
const stylesDir = 'src/client/components/react-dev-overlay/ui/styles'
28872893

0 commit comments

Comments
 (0)