Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[CSS] Difference between <txp:css /> and <link rel="stylesheet">
Hello,
is there any performance difference between loading the default css from the database via <txp:css /> and from a file via <link rel=“stylesheet”>?
Thanks.
Offline
Re: [CSS] Difference between <txp:css /> and <link rel="stylesheet">
Yes, there is a huge performance difference. Have a look at the rvm_css plugin to get the best of both worlds.
Offline
Re: [CSS] Difference between <txp:css /> and <link rel="stylesheet">
Thanks Ruud.
I will try to be more specific. Say I have a single css in the database. I copy & paste it into default.css file. I put this into css folder in my TXP installation. Now I have two options which mutually exclude each other:
1. serving a static css via <txp:rvm_css />
2. serving a static css via <link rel=“stylesheet” href=”../css/default.css” />
Aren’t these equivalent solutions? If not, which is the best performing?
Thanks.
Offline
Re: [CSS] Difference between <txp:css /> and <link rel="stylesheet">
If you use rvm_css
, the plugin will save the CSS not only in the database, but also as a file in the /css directory. Performance is the same, because <txp:rvm_css />
will translate to a call to a static css file. So yes, they are equivalent. If you are used to editing the CSS via the TXP admin interface, the plugin just saves you a bit of work (you don’t have to copy the CSS contents to a static file).
Offline