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

Commit 0242a03

Browse files
authored
Do not generate CSS again (#22)
fix #21
1 parent 398aabe commit 0242a03

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,18 @@ export default function vue(options = {}) {
4747

4848
const styles = {};
4949
let rollupOptions = {};
50+
let generated = false;
5051
const generateStyleBundle = () => {
5152
if (options.css === false) {
5253
return;
5354
}
5455

56+
if (generated) {
57+
return;
58+
}
59+
60+
generated = true;
61+
5562
// Combine all stylesheets.
5663
let css = '';
5764
Object.keys(styles).forEach((key) => {
@@ -115,7 +122,7 @@ export default function vue(options = {}) {
115122
ongenerate(opts, rendered) {
116123
generateStyleBundle();
117124
rendered.code = rendered.code.replace(
118-
/if[\s]*\('__VUE_WITH_STATEMENT__'\)/g, 'with(this)');
125+
/if[\s]*\('__VUE_WITH_STATEMENT__'\)/g, 'with(this)');
119126
},
120127
};
121128
}

0 commit comments

Comments
 (0)