chaincss 2.1.37 → 2.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/vite.js +8 -1
- package/package.json +1 -1
- package/src/plugins/vite.ts +9 -1
package/dist/plugins/vite.js
CHANGED
|
@@ -3326,7 +3326,14 @@ function chaincssPlugin(options = {}) {
|
|
|
3326
3326
|
}
|
|
3327
3327
|
if (id === resolvedCssId) {
|
|
3328
3328
|
const css = updateCSS();
|
|
3329
|
-
|
|
3329
|
+
if (css && css.trim()) {
|
|
3330
|
+
return `const style = document.createElement('style');
|
|
3331
|
+
style.setAttribute('data-chaincss', 'build');
|
|
3332
|
+
style.textContent = ${JSON.stringify(css)};
|
|
3333
|
+
document.head.appendChild(style);
|
|
3334
|
+
export default {};`;
|
|
3335
|
+
}
|
|
3336
|
+
return "export default {};";
|
|
3330
3337
|
}
|
|
3331
3338
|
return null;
|
|
3332
3339
|
},
|
package/package.json
CHANGED
package/src/plugins/vite.ts
CHANGED
|
@@ -276,7 +276,15 @@ export default function chaincssPlugin(options: ChainCSSPluginOptions = {}): Plu
|
|
|
276
276
|
|
|
277
277
|
if (id === resolvedCssId) {
|
|
278
278
|
const css = updateCSS();
|
|
279
|
-
|
|
279
|
+
// Return JS that injects the CSS into the DOM
|
|
280
|
+
if (css && css.trim()) {
|
|
281
|
+
return `const style = document.createElement('style');
|
|
282
|
+
style.setAttribute('data-chaincss', 'build');
|
|
283
|
+
style.textContent = ${JSON.stringify(css)};
|
|
284
|
+
document.head.appendChild(style);
|
|
285
|
+
export default {};`;
|
|
286
|
+
}
|
|
287
|
+
return 'export default {};';
|
|
280
288
|
}
|
|
281
289
|
|
|
282
290
|
return null;
|