Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2009-07-26 21:36:08

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

Re: Better CSS

One of your main objections was that css.php was inside the textpattern directory. It no longer is (well, for compatibility reasons, but that’s not an issue for you).

So the only other thing is the URL. Do visitors really care what URL is used for serving CSS? I don’t think so. Let’s focus on things that really need to be improved, before dealing with stuff like this ;)

Offline

#17 2009-07-27 15:04:36

driz
Member
From: Huddersfield, UK
Registered: 2008-03-18
Posts: 441
Website

Re: Better CSS

no the visitor will not care. but then again the visitor will also not care your even using Textpattern.

BUT the guy behind the scenes cares (well i do) about the efficiency and consistency of files with a website.


~ Cameron

Offline

#18 2009-08-09 01:48:34

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: Better CSS

Bloke wrote:

I would very much like to have the option of CSS in the file system and/or in the DB natively. Treating the file system version like a cache makes sense to me as well. But again: I’m a geek not a designer so this sort of thing is on my radar. Might not be for people of a non-cody mindset?

I’m a designer first, geek second. I’ve launched a whole lot of TXP sites using static CSS files in the file-system, and one or two (very simple designs) that used Textpattern’s CSS tab. Speaking for myself, it never made sense to keep CSS in the database, and I’d be interested in knowing if I’m missing out on the benefits. To me, it seems that the file system offers a lot. In addition to the speed differences already mentioned:

  1. Static files can be kept in version control.
  2. Static files are easier to edit in specialized authoring tools. The SASS compiler I’m using to style a TXP-based discussion site I’m working on offers way more than I would ever reasonably expect from Textpattern (shorthand, variables/mix-ins, compression).
  3. Static files give you absolute control over URL structure.

A few of these things are possible without abandoning Textpattern’s CSS suport as I have, to wit: I use cnk_versioning to keep all my templates in the file system during development. It automatically imports pages, forms, and styles with each refresh when the site’s production status is not Live. One could easily get the best of both worlds using this plugin.

This isn’t a complaint about Textpattern at all. I don’t look to Textpattern to be a top-notch CSS-editing tool— it’s awesome enough without that. Were I publishing stylesheets as downloads like David DeSandro (BBHSHTCL), maybe I would lean more on Textpattern for this. But for now, I’m content with keeping Textpattern agile and powerful with other kinds of content.

Last edited by johnstephens (2009-08-09 01:50:41)

Offline

#19 2009-08-09 19:39:39

TheEric
Plugin Author
From: Colorado & Montana.
Registered: 2004-09-17
Posts: 604
Website

Re: Better CSS

In thinking about it, I’m realizing that there is no specific advantage to having the CSS maintained within the DB. Accessing flat files directly would be marginally faster than by the dB method. Perhaps the CSS editing tool can be revised so that it loads/saves it as a flat file within a CSS specific directory? The only drawback to that would be that the CSS directory would need to be writable, and that can create some security issues.

Oh, and just to clarify, I am by no means agreeing with Driz. THAT would never happen.

Last edited by TheEric (2009-08-09 19:41:04)

Offline

#20 2009-08-09 19:56:21

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

Re: Better CSS

It’s not a security issue. The images/files directory is also writable.
Accessing static CSS files from a visitor perspective is not marginally faster. The speed difference is huge! That’s why I wrote rvm_css.
From an admin side point of view, moving from DB to flat file storage makes no sense at all. There is no noticeable speed difference there.

Offline

#21 2009-08-10 02:06:42

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Better CSS

Writing to files only would also be one more location you have to backup. At least when you’ve got the static+db copy, you only have to backup the db to have the style info saved.

Offline

#22 2009-08-10 08:23:47

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: Better CSS

TheEric wrote:

Oh, and just to clarify, I am by no means agreeing with Driz. THAT would never happen.

It’s times like this when I wish this board had proper smileys!

;0)


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#23 2009-08-10 14:13:32

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: Better CSS

Mary wrote:

Writing to files only would also be one more location you have to backup. At least when you’ve got the static+db copy, you only have to backup the db to have the style info saved.

Backup/portability. Definitely a benefit imho.

Plus, if I have to tweak css when I’m not at my own computer, it’s very simple when the css is in the database.

Offline

#24 2009-08-10 15:10:18

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: Better CSS

I think Textpattern has it right. The CSS belongs in the database. The way to get the best of both worlds is to integrate full-page static caching into the core, and cache CSS files along with content pages. The result would be that the CSS is backed up and transportable along with the rest of the database, but is served at full static file speed (after the initial request).

Offline

#25 2009-08-10 15:19:10

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: Better CSS

artagesw wrote:

The way to get the best of both worlds is to integrate full-page static caching into the core, and cache CSS files along with content pages.

That would be the best of a whole lot of worlds. 4.2.1+?

Offline

#26 2009-08-10 16:30:25

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

Re: Better CSS

I wouldn’t mind seeing rvm_css integrated into core. However, that would require more restricted CSS style names to make good filenames (my plugin tries to do the right thing, but there are situations where it can fail). Since that is almost guaranteed to break things (for people that have weird CSS style sheet names), getting rid of the base64 encoded CSS in the database would be a good thing to do at the same time (as well as deleting the css editor that nobody uses).

Offline

#27 2009-08-10 17:54:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,446
Website GitHub

Re: Better CSS

ruud wrote:

I wouldn’t mind seeing rvm_css integrated into core …getting rid of the base64 encoded CSS in the database would be a good thing to do at the same time (as well as deleting the css editor that nobody uses).

All get my vote. Getting rid of base64 and that ridiculous editor should make TXP fit on a postage stamp ;-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#28 2009-08-10 22:00:37

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: Better CSS

I’ve started to use an external css file for easier editing and also to reduce database/server calls

Offline

Board footer

Powered by FluxBB