Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-09-02 14:12:28

gilibaus
Member
From: Italy
Registered: 2013-08-14
Posts: 92
Website

[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

#2 2015-09-02 14:19:14

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#3 2015-09-04 18:45:24

gilibaus
Member
From: Italy
Registered: 2013-08-14
Posts: 92
Website

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

#4 2015-09-04 18:54:41

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

Board footer

Powered by FluxBB