-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
33 lines (32 loc) · 1.01 KB
/
vite.config.ts
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
// @ts-nocheck
import path from "path";
const pathSrc = path.resolve(__dirname, "./src/components/lib/style");
const pathSrc2 = "./src/components/lib/style/test.scss";
import { md } from "./plugins/md";
import fs from "fs";
import { baseParse } from "@vue/compiler-core";
export default {
base: "/",
assetsDir: "assets",
plugins: [md()],
vueCustomBlockTransforms: {
demo: (options) => {
const { code, path } = options;
const file = fs.readFileSync(path).toString();
const parsed = baseParse(file).children.find((n) => n.tag === "demo");
const title = parsed.children[0].content;
const main = file.split(parsed.loc.source).join("").trim();
return `export default function (Component) {
Component.__sourceCode = ${JSON.stringify(main)}
Component.__sourceCodeTitle = ${JSON.stringify(title)}
}`.trim();
},
},
css: {
// preprocessorOptions: {
// scss: {
// additionalData: `@import "./src/lib/style/theme.scs";`,
// },
// },
},
};