-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CSS options in Vite projects #2245
Changes from all commits
99430f4
ad90f8e
86e0f4d
da30635
6f7217d
8e4b27a
120c4f5
85264b3
5e0e16f
4e8d9ec
0c8b67f
3d2ec74
2220541
4f945db
44880c9
66cecfb
6c8cdda
6951cd4
1e6dd1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/cli-hydrogen': minor | ||
--- | ||
|
||
Support Vite projects in `h2 setup css` command to setup Tailwind and vanilla-extract. Drop CSS setup support for classic Remix projects. |
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
/** | ||
* Configure Tailwind v4 in this file using CSS variables and directives: | ||
* https://tailwindcss.com/blog/tailwindcss-v4-alpha#css-first-configuration | ||
*/ | ||
|
||
@import 'tailwindcss'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
{ | ||
"comment": "Remix version is automatically updated by the CLI", | ||
"dependencies": { | ||
"@remix-run/css-bundle": "^1" | ||
"@vanilla-extract/css": "^1.15.2" | ||
}, | ||
"devDependencies": { | ||
"@vanilla-extract/css": "^1.11.0" | ||
"@vanilla-extract/vite-plugin": "^4.0.10" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ import { | |
flagsToCamelObject, | ||
} from '../../lib/flags.js'; | ||
import {checkCurrentCLIVersion} from '../../lib/check-cli-version.js'; | ||
import { | ||
STYLING_CHOICES, | ||
type StylingChoice, | ||
} from '../../lib/setups/css/index.js'; | ||
import {I18N_CHOICES, type I18nChoice} from '../../lib/setups/i18n/index.js'; | ||
import {supressNodeExperimentalWarnings} from '../../lib/process.js'; | ||
import {setupTemplate, type InitOptions} from '../../lib/onboarding/index.js'; | ||
|
@@ -38,6 +42,7 @@ export default class Init extends Command { | |
description: 'Use mock.shop as the data source for the storefront.', | ||
env: 'SHOPIFY_HYDROGEN_FLAG_MOCK_DATA', | ||
}), | ||
...commonFlags.styling, | ||
...commonFlags.markets, | ||
...commonFlags.shortcut, | ||
routes: Flags.boolean({ | ||
|
@@ -94,6 +99,17 @@ export async function runInit( | |
); | ||
} | ||
|
||
if ( | ||
options.styling && | ||
!STYLING_CHOICES.includes(options.styling as StylingChoice) | ||
) { | ||
throw new AbortError( | ||
`Invalid styling strategy: ${ | ||
options.styling | ||
}. Must be one of ${STYLING_CHOICES.join(', ')}`, | ||
); | ||
} | ||
|
||
options.git ??= true; | ||
|
||
/** | ||
|
@@ -109,6 +125,7 @@ export async function runInit( | |
options.path ??= './hydrogen-quickstart'; | ||
options.routes ??= true; | ||
options.shortcut ??= true; | ||
options.styling ??= 'tailwind'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, tailwind default for quickstart. |
||
} | ||
|
||
const showUpgrade = await checkCurrentCLIVersion(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
export type CssSetupResult = { | ||
workPromise: Promise<unknown>; | ||
generatedAssets: string[]; | ||
helpUrl: string; | ||
needsInstallDeps: boolean; | ||
}; | ||
|
||
export type CssSetupConfig = { | ||
rootDirectory: string; | ||
appDirectory: string; | ||
tailwind?: boolean; | ||
postcss?: boolean; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that
@vanilla-extra/css
went from being adevDependency
to a direct dependency.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's what it's shown in the docs: https://vanilla-extract.style/documentation/getting-started/
I guess it doesn't really matter since this is just an app that is not published to NPM.