4 ms·
If you have single-page web apps, you might as well inline your entire site's CSS, since it's never going to look for the CSS again.
by mozumder 11y ago
If you have single-page web apps, you might as well inline your entire site's CSS, since it's never going to look for the CSS again.
- majewsky 11y agoNot necessarily. If the app changes seldomly, you could reuse a CSS file across multiple sessions, whereas the HTML (i.e. "GET /") is probably always served up fresh. That does not apply, of course, if your initial HTML page is a static asset, too.
- te_chris 11y agoThis is basically what webpack's css-loader does.
- YngwieMalware 11y agoI would probably want to fight you after reading this code.
- exodust 11y agoI did that for a single page web app once, but I took it a step further and inlined the JS too. I was surprised how much I enjoyed developing that way, and how much it didn't bother me. I kept libraries such as Jquery separate. Just the code I was editing I kept all inline in one large HTML file. The self-contained simplicity was appealing, the only hurdle was navigating a large file in my editor. But there's ways to manage that with bookmarks and neatly organised sections and so on. I liked how the smallest component of the app, was the app itself. I see HTML, CSS and JS working together as one unit anyway in a single-pager, so I wanted them living and versioned together. On this particular app, I had lots of dynamic elements updating around and lots of exploring new concepts. Wanted to avoid dependency fragmentation headaches. And to be honest, switching between frontend files can be annoying (to me) when I'm doing lots of tinkering. I'd rather switch between locations in the same file.