Skip to content

Commit

Permalink
refactor!: migration to unocss
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
  • Loading branch information
vinayakkulkarni committed Jul 4, 2023
1 parent 7ad6708 commit df24365
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 75 deletions.
21 changes: 19 additions & 2 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const app: NuxtConfig['app'] = {
head,
};

const components: NuxtConfig['components'] = false;

const css: NuxtConfig['css'] = [
'maplibre-gl/dist/maplibre-gl.css',
'v-mapbox/dist/v-mapbox.css',
Expand All @@ -13,7 +15,7 @@ const css: NuxtConfig['css'] = [
];

const nitro: NuxtConfig['nitro'] = {
preset: 'netlify-builder',
preset: 'netlify',
};

const plugins: NuxtConfig['plugins'] = [
Expand All @@ -22,6 +24,11 @@ const plugins: NuxtConfig['plugins'] = [
{ src: '~/plugins/v-web-workers.ts', mode: 'client' },
];

const routeRules: NuxtConfig['routeRules'] = {
// Homepage pre-rendered at build time
'/': { prerender: true },
};

const runtimeConfig: NuxtConfig['runtimeConfig'] = {
public: {
map: {
Expand All @@ -45,4 +52,14 @@ const typescript: NuxtConfig['typescript'] = {
};

export { modules } from './modules';
export { app, css, nitro, plugins, runtimeConfig, ssr, typescript };
export {
app,
components,
css,
nitro,
plugins,
routeRules,
runtimeConfig,
ssr,
typescript,
};
6 changes: 3 additions & 3 deletions config/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NuxtConfig } from 'nuxt/schema';
import { plausible } from './plausible';
import { pwa } from './pwa';
import { windicss } from './windicss';
import { unocss } from './unocss';

const modules: NuxtConfig['modules'] = [
// https://pinia.esm.dev/ssr/nuxt.html#nuxt-js
Expand All @@ -12,8 +12,8 @@ const modules: NuxtConfig['modules'] = [
['@kevinmarrec/nuxt-pwa', pwa],
// https://github.com/nuxt-modules/plausible#setup
['@nuxtjs/plausible', plausible],
// https://windicss.org/guide/
['nuxt-windicss', windicss],
// https://unocss.dev/integrations/nuxt
['@unocss/nuxt', unocss],
];

export { modules };
6 changes: 6 additions & 0 deletions config/modules/unocss.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const unocss = {
attributify: true,
icons: true,
components: false,
shortcuts: [],
};
11 changes: 0 additions & 11 deletions config/modules/windicss.ts

This file was deleted.

39 changes: 39 additions & 0 deletions uno.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
presetWebFonts,
transformerDirectives,
transformerVariantGroup,
} from 'unocss';

export default defineConfig({
content: {
pipeline: {
include: [
// the default
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
// include js/ts files
'**/*.{js,ts}',
],
// exclude files
// exclude: []
},
},
presets: [
presetUno(),
presetAttributify(),
presetIcons(),
presetTypography(),
presetWebFonts({
provider: 'google',
fonts: {
sans: 'Inter var',
mono: ['Fira Code', 'Fira Mono:400,700'],
},
}),
],
transformers: [transformerDirectives(), transformerVariantGroup()],
});
59 changes: 0 additions & 59 deletions windi.config.ts

This file was deleted.

0 comments on commit df24365

Please sign in to comment.