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

Commit 5613a11

Browse files
committed
Always call css() if defined
1 parent 5886757 commit 5613a11

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/index.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,17 @@ export default function vue(options = {}) {
5858
css += styles[key].content || '';
5959
});
6060

61-
// Don't generate empty style file.
62-
if (!css.trim().length) {
63-
return;
64-
}
6561
// Emit styles through callback
6662
if (typeof options.css === 'function') {
6763
options.css(css, styles);
6864
return;
6965
}
7066

67+
// Don't generate empty style file.
68+
if (!css.trim().length) {
69+
return;
70+
}
71+
7172
let dest = options.css;
7273
if (typeof dest !== 'string') {
7374
// Guess destination filename
@@ -111,6 +112,11 @@ export default function vue(options = {}) {
111112

112113
return source.replace(/if[\s]*\('__VUE_WITH_STATEMENT__'\)/g, 'with(this)');
113114
},
115+
ongenerate(opts, rendered) {
116+
generateStyleBundle();
117+
rendered.code = rendered.code.replace(
118+
/if[\s]*\('__VUE_WITH_STATEMENT__'\)/g, 'with(this)');
119+
},
114120
};
115121
}
116122

0 commit comments

Comments
 (0)