I want to provide an option to change colors of my website. Just like those wordpress themes that allow to change the Color & fonts from backend.
Is there a proper way to achieve this thing without posting css rules in style tag?
Like changing Sass variables from backend and compiling it from the server?
Note that this is untested psuedo-code, but it should get you on the right track. You could also point your route to a CSS controller and prepare/return the view there.
I've modified @Jeffberry's code to make it look less dynamic (to anyone browser the source code it looks like a normal .css file). Also sends the correct headers.
I haven't tested it though, but I've done the same before with robots.txt which worked fine.