Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

feat(plugins/unocss): decouple unocss plugin from netzo #136

Merged
merged 3 commits into from
Feb 15, 2024

Conversation

miguelrk
Copy link
Contributor

@miguelrk miguelrk commented Feb 15, 2024

Closes https://github.com/netzo/netzo/issues/114. See also https://github.com/netzo/netzo/issues/85#issuecomment-1925870041.

The components module is to be dropped in favor of a standalone unocss plugin to decouple it from netzo.

  • updates to local unocss dependencies
  • removes netzo-specific options property from UnocssOptions
  • updates unocss to require explicit uno.config.ts file when csr mode enabled
  • remove bundle:csr task workaround to instead load original uno.config.ts from client (now that it's required when csr mode enabled)
  • removes netzo/plugins/components in favor of netzo/plugins/unocss and netzo preset
  • update theme defaults to { color: "zinc", radius: 0.5 }
  • updates templates accordingly
  • adds fixtures-plugins-unocss

Before

The components module would setup an adapted unocss fresh plugin internally and handle theming.

// netzo.ts
import { Netzo } from "netzo/mod.ts";

export const netzo = await Netzo({
  components: {
    theme: { color: "red", radius: 1.0 }
  }
});
if (import.meta.main) netzo.start();

Now

The standalone unocss fresh plugin uses a conventional uno.config.ts file and presetNetzo handles theming. Note that note that NetzoConfig extends FreshConfig so we can directly pass a fresh plugins array.

// netzo.ts
import { Netzo } from "netzo/mod.ts";
import { unocss } from "netzo/plugins/unocss/plugin.ts";

export const netzo = await Netzo({
  plugins: [unocss()], // auto-loads uno.config.ts
});
if (import.meta.main) netzo.start();
// uno.config.ts
import { defineConfig } from "netzo/plugins/unocss/plugin.ts";
import { presetNetzo } from "netzo/plugins/unocss/preset-netzo.ts";

export default defineConfig({
  presets: [
    presetNetzo({ color: "red", radius: 1.0 }),
  ],
});

Verified

This commit was signed with the committer’s verified signature.
KoalaSat KoalaSat
- removes netzo-specific `options` property from `UnocssOptions`
- updates `unocss` to require explicit `uno.config.ts` file when `csr` mode enabled
- remove `bundle:csr` task workaround to instead load original `uno.config.ts` from client (now that it's required when `csr` mode enabled)
- removes `netzo/plugins/components` in favor of `netzo/plugins/unocss` and netzo preset
- update theme defaults to `{ color: "zinc", radius: 0.5 }`
- updates templates accordingly
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[chore] remove remaining hardcoded version references
1 participant