feat!: simplify UnoCSS integration#270
Conversation
BREAKING CHANGES: - `@tutorialkit/astro` package no longer exports `unoCSSConfig`. Use `defineConfig` from `@tutorialkit/theme` instead. - `@tutorialkit/theme` package no longer exports `rules`, `shortcuts` and `theme`. - `@tutorialkit/theme` package exports `transitionTheme` from new entrypoint: `@tutorialkit/theme/transition-theme`.
|
|
|
@Nemikolh what do you think about adding https://pkg.pr.new to TutorialKit? Verifying changes like this would be really great if I could use real published packages. Relying on linked ( |
|
Oh that would be really cool! I like a lot that idea 😃 |
Nemikolh
left a comment
There was a problem hiding this comment.
Wooow, impressive work! This looks insanely good. 😍
Good job 😃
| UnoCSS({ | ||
| configDeps: ['./theme.ts'], | ||
| injectReset: true, | ||
| injectReset: createRequire(root).resolve('@unocss/reset/tailwind.css'), |
There was a problem hiding this comment.
Oh I'm curious: why is the root needed? Is it because @unocss/reset is not a dependency of @tutorialkit/astro?
What about we add it as a dependency?
Or we could also keep the true value.
There was a problem hiding this comment.
Oh that is strange, could that be a bug in the unocss astro integration?
There was a problem hiding this comment.
This is also mentioned on UnoCSS:
Now that we don't require end-users (or template) to add @unocss/reset as their dependency, it's likely causing a hoisting issue here, like mentioned on the issue. Using require.resolve solves this.
There was a problem hiding this comment.
Gotcha, thanks for the clarification!
This comment was marked as outdated.
This comment was marked as outdated.
|
/pkg-pr-new |
|
Changes of this PR are now deployed and running at AriPerkkio/tutorial-vite-plugin#21. @Nemikolh I'm trying to think of all kinds of scenarios that should be tested there, mainly focusing on trying to see that user's own |
|
@AriPerkkio Not that I can think of! We can always fix them later once we encounter them. Let's move forward with this PR |
This reverts commit 8d49ef8.

unoCSSConfigfrom@tutorialkit/astro#244Moves all configuration from
uno.config.tsbehind@tutorialkit/themeand@tutorialkit/astropackages. Users are no-longer needed to have complexuno.config.tsfiles in their projects. In cases like #184 we no longer need to instruct users to modify theiruno.config.ts- we can actually apply these in@tutorialkitpackages and just release them.Adds a custom
defineConfigto@tutorialkit/theme, that can be used to configure TutorialKit theme and add additional UnoCSS configurations:UnoCSS VS Code extension still works as expected:
Migration guide for projects:
In your
package.json:"dependencies": { "@tutorialkit/components-react": "0.1.5", "react": "^18.3.1", "react-dom": "^18.3.1" }, "devDependencies": { "@astrojs/check": "^0.7.0", "@astrojs/react": "^3.6.0", - "@iconify-json/ph": "^1.1.13", - "@iconify-json/svg-spinners": "^1.1.2", "@tutorialkit/astro": "0.1.5", + "@tutorialkit/theme": "0.1.5", "@tutorialkit/types": "0.1.5", "@types/node": "^20.14.6", "@types/react": "^18.3.3", - "@unocss/reset": "^0.59.4", "astro": "^4.12.0", - "fast-glob": "^3.3.2", "prettier-plugin-astro": "^0.14.1", "typescript": "^5.4.5", - "unocss": "^0.59.4" }In your
uno.config.ts:BREAKING CHANGES:
@tutorialkit/astropackage no longer exportsunoCSSConfig. UsedefineConfigfrom@tutorialkit/themeinstead.@tutorialkit/themepackage no longer exportsrules,shortcutsandtheme.@tutorialkit/themepackage exportstransitionThemefrom new entrypoint:@tutorialkit/theme/transition-theme.