Storing CSS in mysql database

I store CSS (style sheets) in a MySQL database, so when I call it, I only have one way that should reflect it on the page itself. Anyway, can I process the database data as a .css file basically?

+4
source share
2 answers

You will probably need to read the CSS once at startup and save it to a file somewhere in your deployment folder, and then link to it with the code <link rel="stylesheet" type="text/css" href="style.css"> . How exactly you do this will depend on your environment and the specific web server.

In any case, it is always desirable that CSS be an external resource for a number of reasons, for example. because CSS resources are cached by web browsers as opposed to dynamic pages.

+1
source

I decided to just go with the download from the .css file, myself, thanks for the help.

0
source

Source: https://habr.com/ru/post/1438039/


All Articles