plugins
β
The plugins
module exports all Plugins for the Fresh framework. Plugins can dynamically add new functionality to Fresh without exposing significant complexity to the user. Users can add plugins by importing and initializing them in the start
function of main.ts
:
tsx
// main.ts
import manifest from './fresh.gen.ts'
import twindConfig from './twind.config.js'
import { start } from '$fresh/server.ts'
import twindPlugin from '$fresh/plugins/twind.ts'
await start(manifest, {
plugins: [
twindPlugin(twindConfig), // configures the first-party twind plugin
],
})
// main.ts
import manifest from './fresh.gen.ts'
import twindConfig from './twind.config.js'
import { start } from '$fresh/server.ts'
import twindPlugin from '$fresh/plugins/twind.ts'
await start(manifest, {
plugins: [
twindPlugin(twindConfig), // configures the first-party twind plugin
],
})
Apart from first-party plugins, and those provided by netzo/lib/plugins
, you can also search for community plugins or create your own.
Fresh plugins are only available in Fresh 1.1 or above
UnoCSS β
UnoCSS is an instant, on-demand atomic CSS engine. It generates atomic CSS classes on the fly based on the classes and attributes used in your project.
tsx
await start(manifest, {
plugins: [
unocss({ build: 'uno' }),
],
})
await start(manifest, {
plugins: [
unocss({ build: 'uno' }),
],
})