ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

CSS as a flat file or as an EE template?

March 27, 2012 10:08am

Subscribe [3]
  • #1 / Mar 27, 2012 10:08am

    strudel

    195 posts

    Greetings all,

    Just a simple question. Do you find it preferable to run your CSS as an EE template, or as a plain CSS (“style.css”) file?

    I’ve heard some people do things one way and others the other way; I’ve been running my CSS as an EE template, but I’m curious if there are any good reasons to just use a *.css file.

    Thanks in advance!

  • #2 / Mar 27, 2012 10:32am

    Matt:P

    277 posts

    Hi Strudel

    I have done both and find that running CSS as a file instead of a template helps a little with speed. Generally if there’s no reason for EE to parse a CSS file, then I just use a plain css file.

    Have a read of this, Chris Imrie wrote a great article a while ago which I refer to from time to time: http://www.netmagazine.com/tutorials/optimise-your-expressionengine-site

    Be interesting to see what others say.

    Matt

  • #3 / Mar 27, 2012 11:59am

    Bhashkar Yadav

    727 posts

    Matt, you are right. when we put any content as EE template, EE does some extra processing to load it.

    Its always better to use plain css and js file.

  • #4 / Mar 29, 2012 11:17pm

    strudel

    195 posts

    Hi,

    Thanks for the tip on the Chris Imrie optimization article; I had happened on that before and bookmarked it, and it’s been helpful.

    When you say to have the js in a separate file, please excuse a simple question. I use only very little js because I don’t know it; so are you talking about the javascript that might go in the head of a document, or are you talking about something else?

    Also, as far as CSS in a regular CSS file, I’ve been thinking about that if for no other reason than simplying the editing process (I’m using the CSSEdit for that).

    Thanks for all the info!

  • #5 / Mar 30, 2012 5:06am

    Matt:P

    277 posts

    When you say to have the js in a separate file, please excuse a simple question. I use only very little js because I don’t know it; so are you talking about the javascript that might go in the head of a document, or are you talking about something else?

    Any JS files which are needed e.g. tablesorter.js

    Also, as far as CSS in a regular CSS file, I’ve been thinking about that if for no other reason than simplying the editing process (I’m using the CSSEdit for that).

    My approach is that if EE needs to render something into a CSS file, like an (background) image url, then I will create a CSS template so that the file and any EE tags are parsed. If not then i just make traditional CSS files.

    As a side note you can still use CSSEdit (or other) to edit your templates by asking EE to save them as files as well as store them in the DB. see here: http://ellislab.com/expressionengine/user-guide/templates/templates_as_files.html

  • #6 / May 19, 2012 3:42pm

    OrganizedFellow

    435 posts

    For simplicity, I have the following directory structure for all my sites - ExpressionEngine and flat file.

    myawesomesite.com/_js/
    myawesomesite.com/_css/

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases