mnfst-render 0.5.19 → 0.5.20
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/manifest.render.mjs +17 -1
- package/package.json +1 -1
package/manifest.render.mjs
CHANGED
|
@@ -661,6 +661,16 @@ function stripRuntimeTailwindArtifacts(html) {
|
|
|
661
661
|
return out;
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
+
// When tailwindcss isn't installed for the project, the prerender keeps the
|
|
665
|
+
// runtime-injected inline tailwind <style> block (it serves the static page
|
|
666
|
+
// for crawlers). But we must still strip `data-tailwind` from the loader
|
|
667
|
+
// script tag, otherwise the runtime tailwind plugin loads at page boot and
|
|
668
|
+
// injects ANOTHER tailwind <style> block AFTER prerender.utilities.css,
|
|
669
|
+
// breaking the cascade order so .hidden wins over .lg:col etc.
|
|
670
|
+
function stripDataTailwindAttr(html) {
|
|
671
|
+
return html.replace(/\sdata-tailwind(?:=(["']).*?\1)?/gi, '');
|
|
672
|
+
}
|
|
673
|
+
|
|
664
674
|
/** Manifest utilities plugin: <style id="utility-styles"> and <style id="utility-styles-critical"> */
|
|
665
675
|
function extractUtilityStyleBlocks(html) {
|
|
666
676
|
const blocks = [];
|
|
@@ -1409,7 +1419,11 @@ function generateLocaleVariantHtml({
|
|
|
1409
1419
|
// Standard Node.js post-processing (same sequence as processPath)
|
|
1410
1420
|
html = stripDevOnlyContent(html);
|
|
1411
1421
|
html = stripInjectedPluginScripts(html, config.root);
|
|
1412
|
-
if (tailwindBuilt)
|
|
1422
|
+
if (tailwindBuilt) {
|
|
1423
|
+
html = stripRuntimeTailwindArtifacts(html);
|
|
1424
|
+
} else {
|
|
1425
|
+
html = stripDataTailwindAttr(html);
|
|
1426
|
+
}
|
|
1413
1427
|
|
|
1414
1428
|
const pageUtilityBlocks = [];
|
|
1415
1429
|
if (bundleUtilities) {
|
|
@@ -2922,6 +2936,8 @@ async function runPrerender(config) {
|
|
|
2922
2936
|
html = stripInjectedPluginScripts(html, config.root);
|
|
2923
2937
|
if (tailwindBuilt) {
|
|
2924
2938
|
html = stripRuntimeTailwindArtifacts(html);
|
|
2939
|
+
} else {
|
|
2940
|
+
html = stripDataTailwindAttr(html);
|
|
2925
2941
|
}
|
|
2926
2942
|
if (bundleUtilities) {
|
|
2927
2943
|
const extracted = extractUtilityStyleBlocks(html);
|