Hi, so I know I can put CSS into the database, by creating a document for the CSS file and then choosing content-type = text/css. I have always wondered about this though, and therefore have been hesitant to use it.
1. Does this work in friendly URLs?
2. Does the linking to the stylesheet work the same way?
3. Will MODX append .css to the file even though in friendly URLs I have the extension set to .html?
4. Is there anything else I need to know about this? Anyone have any suggestions of best-practices?
5. In practice, what is the best way for you to do it? Do you find it easier having your CSS as files or residing in the database?
Thanks in advance for your thoughtful replies.
(Referencing where I brought this up here:
http://modxcms.com/forums/index.php/topic,64043.msg363539.html#msg363539)
"Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein
-
☆ A M B ☆
- 24,524 Posts
Which version of MODx are you using? My remarks will pertain to Evo.
1. Yes, in fact it works better with friendly URLs.
2. Yes, in your template you can use the MODx link tags.
3. Evo, no. With Revo, I believe the type overrides your suffix setting.
5. I’ve found it more of an interesting theoretical application than of any actual practical use, especially since I tend to be editing the .css file at the same time I’m working with resources and elements in the Manager, so having my .css file open in my editor (via FTP) is more useful. I can be doing .css editing while waiting for the Manager to update and vice versa. If a user doesn’t know how to use FTP I would strongly suspect that he’s got no business messing with the CSS! Besides, in a pinch, you can always edit via the Manager’s File Manager. Just make sure your .css files are writable for your php user, as it’s done via a PHP script.
Quote from: sottwell at May 08, 2011, 03:11 AM
Which version of MODx are you using? My remarks will pertain to Evo.
Thanks, that was a good call. Evo it is, I should have been more specific.
Quote from: sottwell at May 08, 2011, 03:11 AM
3. Evo, no. With Revo, I believe the type overrides your suffix setting.
So how does it work with the browser? The browser will read it as CSS even though it is appended with .html? This is probably only a theoretical question at this point, so feel free to not answer.
Quote from: sottwell at May 08, 2011, 03:11 AM
5. I’ve found it more of an interesting theoretical application than of any actual practical use, especially since I tend to be editing the .css file at the same time I’m working with resources and elements in the Manager, so having my .css file open in my editor (via FTP) is more useful. I can be doing .css editing while waiting for the Manager to update and vice versa. If a user doesn’t know how to use FTP I would strongly suspect that he’s got no business messing with the CSS! Besides, in a pinch, you can always edit via the Manager’s File Manager. Just make sure your .css files are writable for your php user, as it’s done via a PHP script.
Ditto. I was merely wondering if there were better ways to work with this than what I’ve been doing. Thanks for the quick reply.
"Great spirits have always encountered violent opposition from mediocre minds." -Albert Einstein