Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 88da113

Browse files
committed
feat: support css preprocessors
1 parent 87a6150 commit 88da113

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: src/index.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
8585

8686
return undefined
8787
},
88+
8889
load(id) {
8990
const query = parseVuePartRequest(id)
9091

@@ -192,6 +193,9 @@ export default function PluginVue(userOptions: Partial<Options> = {}): Plugin {
192193
source: block.content,
193194
scoped: block.scoped,
194195
modules: !!block.module,
196+
modulesOptions: options.cssModulesOptions,
197+
preprocessLang: block.lang as any,
198+
preprocessCustomRequire: options.preprocessCustomRequire,
195199
})
196200

197201
if (result.errors.length) {
@@ -477,8 +481,8 @@ function attrsToQuery(attrs: SFCBlock['attrs'], langFallback?: string): string {
477481
}`
478482
}
479483
}
480-
if (langFallback && !(`lang` in attrs)) {
481-
query += `&lang.${langFallback}`
484+
if (langFallback) {
485+
query += `lang` in attrs ? `.${langFallback}` : `&lang.${langFallback}`
482486
}
483487
return query
484488
}
@@ -521,3 +525,6 @@ function genCSSModulesCode(
521525
code += `\ncssModules["${name}"] = ${styleVar}`
522526
return code
523527
}
528+
529+
// overwrite for cjs require('rollup-plugin-vue')() usage
530+
module.exports = PluginVue

0 commit comments

Comments
 (0)