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.
@@ -3326,7 +3326,14 @@ function chaincssPlugin(options = {}) {
3326
3326
  }
3327
3327
  if (id === resolvedCssId) {
3328
3328
  const css = updateCSS();
3329
- return css || "/* ChainCSS: No styles */";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaincss",
3
- "version": "2.1.37",
3
+ "version": "2.1.38",
4
4
  "description": "ChainCSS - The first CSS-in-JS library with true auto-detection mixed mode. Zero runtime by default, dynamic when you need it.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -276,7 +276,15 @@ export default function chaincssPlugin(options: ChainCSSPluginOptions = {}): Plu
276
276
 
277
277
  if (id === resolvedCssId) {
278
278
  const css = updateCSS();
279
- return css || '/* ChainCSS: No styles */';
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;