Skip to content

Commit

Permalink
Move css module options based on build order
Browse files Browse the repository at this point in the history
  • Loading branch information
qrac committed Jun 6, 2022
1 parent 95c0525 commit 96807e5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 43 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ export default defineConfig({
},
},
vite: {}, // https://ja.vitejs.dev/config/
css: {
modules: {
cache: true,
scopeBehaviour: "local",
globalModulePaths: [],
generateScopedName: undefined,
hashPrefix: "",
localsConvention: "camelCaseOnly",
}, // https://ja.vitejs.dev/config/#css-modules
preprocessorOptions: {
scss: {},
less: {},
stylus: {},
}, // https://ja.vitejs.dev/config/#css-preprocessoroptions
},
markdown: {
syntaxHighlighter: "highlight", // "highlight" | "none"
highlightOptions: {}, // https://github.com/rehypejs/rehype-highlight#options
Expand All @@ -160,21 +175,6 @@ export default defineConfig({
cssOptions: {}, // https://github.com/beautify-web/js-beautify#css--html
jsOptions: {}, // https://github.com/beautify-web/js-beautify#options
},
css: {
modules: {
generateScopedName: undefined,
globalModulePaths: [],
hashPrefix: "",
localsConvention: "camelCaseOnly",
scopeBehaviour: "local",
cache: true,
}, // https://ja.vitejs.dev/config/#css-modules
preprocessorOptions: {
scss: {},
less: {},
stylus: {},
}, // https://ja.vitejs.dev/config/#css-preprocessoroptions
},
})
```

Expand Down
30 changes: 15 additions & 15 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ export const defaultConfig: MinistaConfig = {
},
},
vite: {},
css: {
modules: {
cache: true,
scopeBehaviour: "local",
globalModulePaths: [],
generateScopedName: undefined,
hashPrefix: "",
localsConvention: "camelCaseOnly",
},
preprocessorOptions: {
scss: {},
less: {},
stylus: {},
},
},
markdown: {
syntaxHighlighter: "highlight",
highlightOptions: {},
Expand All @@ -92,21 +107,6 @@ export const defaultConfig: MinistaConfig = {
cssOptions: {},
jsOptions: {},
},
css: {
modules: {
generateScopedName: undefined,
globalModulePaths: [],
hashPrefix: "",
localsConvention: "camelCaseOnly",
scopeBehaviour: "local",
cache: true,
},
preprocessorOptions: {
scss: {},
less: {},
stylus: {},
},
},
}

export async function mergeConfig(
Expand Down
26 changes: 13 additions & 13 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export type MinistaConfig = {
}
}
vite: ViteUserConfig
css: CssOptions
markdown: {
syntaxHighlighter: "highlight" | "none"
highlightOptions: HighlightOptions
Expand All @@ -87,7 +88,6 @@ export type MinistaConfig = {
cssOptions: CSSBeautifyOptions
jsOptions: JSBeautifyOptions
}
css: CssOptions
}

export type MinistaUserConfig = {
Expand Down Expand Up @@ -150,6 +150,7 @@ export type MinistaUserConfig = {
}
}
vite?: ViteUserConfig
css?: CssUserOptions
markdown?: {
syntaxHighlighter?: "highlight" | "none"
highlightOptions?: HighlightOptions
Expand All @@ -162,7 +163,6 @@ export type MinistaUserConfig = {
cssOptions?: CSSBeautifyOptions
jsOptions?: JSBeautifyOptions
}
css?: CssUserOptions
}

export type MinistaResolveConfig = MinistaConfig & MinistaResolvePathConfig
Expand Down Expand Up @@ -278,17 +278,6 @@ export type PartialString = {
[key: string]: string
}

export type CSSModulesOptions = {
cache: boolean
scopeBehaviour: "global" | "local"
globalModulePaths: RegExp[]
generateScopedName:
| undefined
| string
| ((name: string, filename: string, css: string) => string)
hashPrefix: string
localsConvention: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly"
}
export type CssOptions = {
modules: CSSModulesOptions | false
preprocessorOptions: {
Expand All @@ -305,3 +294,14 @@ export type CssUserOptions = {
stylus?: Stylus.RenderOptions
}
}
export type CSSModulesOptions = {
cache: boolean
scopeBehaviour: "global" | "local"
globalModulePaths: RegExp[]
generateScopedName:
| undefined
| string
| ((name: string, filename: string, css: string) => string)
hashPrefix: string
localsConvention: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly"
}

0 comments on commit 96807e5

Please sign in to comment.