package.json
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| {
"type": "module",
"scripts": {
"dev": "unocss \"**/*.html\" -o main.css --watch & vite",
"build": "unocss \"**/*.html\" -o main.css && vite build"
},
"dependencies": {
"@shoelace-style/shoelace": "^2.15.1",
"pako": "^2.1.0",
"unocss": "^0.60.4",
"vite": "^5.2.12",
"vite-plugin-static-copy": "^1.0.5"
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| // uno.config.ts
import {
defineConfig,
presetAttributify,
presetTypography,
presetUno
} from 'unocss'
export default defineConfig({
presets: [
presetAttributify(), // required when using attributify mode
presetUno(), // required
presetTypography(),
],
})
|
Update the base
if you are deploying it somewhere else, I'm using
github pages without a domain so it's in a subdirectory.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| // vite.config.js
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
const iconsPath = 'node_modules/@shoelace-style/shoelace/dist/assets/icons';
// https://vitejs.dev/config/
export default defineConfig({
base: '/nodepadjs/', // Or / if you arent using github pages
resolve: {
alias: [
{
find: /\/assets\/icons\/(.+)/,
replacement: `${iconsPath}/$1`,
},
],
},
build: {
rollupOptions: {
// external: /^lit/,
plugins: [],
},
},
plugins: [
viteStaticCopy({
targets: [
{
src: iconsPath,
dest: 'assets',
},
],
}),
],
});
|