macaron-css / macaron

Compiler-augmented typesafe CSS-in-JS with zero runtime, colocation, maximum safety and productivity
https://macaron.js.org/
MIT License
735 stars 16 forks source link

Esbuild example with .html #22

Closed posobin closed 1 year ago

posobin commented 1 year ago

Is there a full esbuild example? The one linked in the documentation here emits an index.js and an index.css files. What's the suggested way to use these files in an html page? Should I just add a <link src="index.css" rel="stylesheet" /> tag in the html? Would this always be single a compiled stylesheet if I have several styled components in different files?

Mokshit06 commented 1 year ago

Hi, yes you're correct. Just add the link and script tags pointing to the output files (dist/index.js and dist/index.css) in the html file. The styles will always be compiled into a single css file, this is the way esbuild works.