Confusing Returnings of Server Side Rendering API
See original GitHub issueDescription
Expected SSR generates a rendered (styles included) HTML content. But it seems that it only parses the html and outputs the generated CSS.
confusing returnings:
html
in the output is the same as the input one and useless.stylesCss
should contain color variables used in HTML.colorsCss
is always about 20 kb in size without any tree-shaking, no matter what the input is.colorsMetaContent
is useless, I don’t know in which case it will be used.
That is, developers need to inject the uncompleted (without color variables) or unused (too many color variables) CSS into HTML manually, which is not good for DX and performance.
BTW, the SSR example on the document is outdated.
Reproduction
import { render } from "@master/css/render";
import { StyleSheet, Style } from "@master/css";
const target: string[] = [
`<div class="p:12"></div>`,
`<div class="font:24 font:56@2xl font:48@lg font:32@md bg:blue-54:hover bg:blue-47 bg:blue-68:active color:orange"></div>`,
];
for (const html of target) {
test(html);
}
function test(html: string) {
const key = `render \x1b[93m${html}\x1b[m`;
console.time(key);
const result = render(html, { StyleSheet, Style });
console.timeEnd(key);
console.log("html:", `\x1b[92m${result.html}\x1b[m`);
console.log("stylesCss:", `\x1b[96m${result.stylesCss}\x1b[m`);
console.log("colorsMetaContent:", `\x1b[94m${result.colorsMetaContent}\x1b[m`);
console.log("length of colorsCss:", `\x1b[95m${result.colorsCss.length}\x1b[m`);
}
System Informations
@master/css
: 1.17.2
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Server Side Rendering (SSR) vs. Client Side Rendering (CSR ...
Client Side Rendering means generating the HTML components on the browser side, by executing Javascript code within the browser that ...
Read more >Client-Side Rendering vs Server-Side Rendering vs Static ...
In this article, we discuss the pros and cons of client-side rendering (CSR), server-side rendering (SSR) and static-site generation (SSG).
Read more >Aurelia Server Side Rendering - Avoid unnecessary client ...
I have an Aurelia application based on Aurelia CLI 1.2.x and Webpack 4, and using Server Side Rendering because search engine indexation is ......
Read more >What advantages are conferred by using server-side page ...
Client -side HTML rendering: Lower bandwidth usage; Slower initial page render. May not even be noticeable in modern desktop browsers.
Read more >Server-Side Rendering (SSR) Vs Client-Side Rendering (CSR)
Clear separation of the concerns between the client and the server; you can easily build new clients for different platforms (e.g. mobile, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JacobLinCool I think we might go with your idea - the preset will map colors and inline the rgb into CSS rules, for a minimal output.
Thx again. 😌
@JacobLinCool This issue has been sorted into milestone. 😌 https://github.com/master-co/css/milestone/1