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.

External CSS

April 08, 2009 12:34pm

Subscribe [4]
  • #1 / Apr 08, 2009 12:34pm

    NateL

    248 posts

    Alright,

    I do not want my CSS files turned into PHP files. I just want CSS files that I can manipulate and work with without having to update the database each time I make a change.

    In my templates folder, I have a CSS folder with 960 CSS framework, and a default.css file.

    In the AdminCP, in the template section, I clicked on “New Template” and chose CSS as the file type, “default” as the name, and checked “Use a template from your library” and selected the default.css as the file to reference.

    Inside index.php I have

    {assign_variable:my_template_group="my_template"}
    <link rel='stylesheet' type='text/css' media='all' href='{stylesheet={my_template_group}/default}' />

    Well, now default.css works - until I modify default.css on my system.

    I edit default.css in the AdminCP and it still shows the old settings.

    If I click “save template as file” - well, now it’s a PHP file saved in the template root, not in my CSS folder.

    hope this makes sense what I’m doing. Hope someone can help.

    Thanks 😊

  • #2 / Apr 08, 2009 12:58pm

    NateL

    248 posts

    well, my only solution at this point is to link directly to it with this code:

    <link rel='stylesheet' type='text/css' media='all' href='{site_url}/system/templates/{my_template_group}/css/default.css' />

    which does the job, but does not seem right.

    It returns this URL:
    http://localhost/system/templates/my_template/css/default.css

  • #3 / Apr 08, 2009 1:42pm

    grrramps

    2219 posts

    I do not want my CSS files turned into PHP files.

    How does that happen?

    I just want CSS files that I can manipulate and work with without having to update the database each time I make a change.

    You get your choice of using EE’s templates for CSS files (many advantages) or creating a static CSS file and linking to it in the header.

    In my templates folder, I have a CSS folder with 960 CSS framework, and a default.css file.

    What is a “templates folder”? Are you using EE’s templates? Or, did you create an external folder to hold templates?

    In the AdminCP, in the template section, I clicked on “New Template” and chose CSS as the file type, “default” as the name, and checked “Use a template from your library” and selected the default.css as the file to reference.

    That means you’re using EE’s templates for the CSS files.

    Inside index.php I have

    Do you mean the “index” template of your template group? That’s different than the site’s index.php file.

    Well, now default.css works - until I modify default.css on my system.

    hope this makes sense what I’m doing. Hope someone can help.

    Are you modifying the CSS file in EE’s templates? Or, somewhere else? If your index page links to the CSS file in EE’s templates, then editing the same template file will result in a change.

  • #4 / Apr 08, 2009 1:43pm

    Danny T.

    426 posts

    Dear Nate,

    Perhaps others can elaborate more, but when you save a template as a file, it should reference your file version as the most recent revision and use that instead of whatever may be in your database. As long as you still have that file checked to reference a file in your templates preferences, then it should reflect changes you’ve made directly in your file.

    I might not be understanding your OP, but I think that would solve the problem anyway.

  • #5 / Apr 08, 2009 2:07pm

    NateL

    248 posts

    How does that happen?

    I have my options set to save templates as files - so when I save it as a file, it saves as default.php rather than default.css

    You get your choice of using EE’s templates for CSS files (many advantages) or creating a static CSS file and linking to it in the header.

    I’m trying right now to link to it in the header.

    My method in developing the CSS is pretty simple - I think.  Open the CSS file, make changes, save, view the changes in the browser. 

    Yes, I can see the advantages to having it editable within the AdminCP, but I prefer using something like CSSEdit to speed things up.

    What is a “templates folder”? Are you using EE’s templates? Or, did you create an external folder to hold templates?

    I created my own template folder, mimicking the “site” template that already exists.

    system/templates/site
    system/templates/my_template

    That means you’re using EE’s templates for the CSS files.

    yes? I don’t suppose I want to. I really don’t know.

    Do you mean the “index” template of your template group? That’s different than the site’s index.php file.

    system/templates/my_template/index.php

    the index file of the now default template of the site.

    Are you modifying the CSS file in EE’s templates? Or, somewhere else? If your index page links to the CSS file in EE’s templates, then editing the same template file will result in a change.

    I’m using external editors to modify the CSS. The colored coding and additional abilities that external editors provide me is the reason I am trying to avoid using the EE database.

  • #6 / Apr 08, 2009 2:12pm

    grrramps

    2219 posts

    I’m using external editors to modify the CSS. The colored coding and additional abilities that external editors provide me is the reason I am trying to avoid using the EE database.

    I use CSSEdit in my workflow, too, but prefer to use EE’s templates, rather than static files. It takes all of two seconds to copy an edited, updated CSS file from CSSEdit to an open EE template window and click Save. CSSEdit is a great tool. Having the CSS in EE’s templates rather than as a static file has other advantages (I’ve done it both ways). Versioning is very helpful, of course. which is more difficult when using an editor on a static file. Plus, EE caches the CSS template file appropriately (and changes the CSS file name) so any change is reflected in the browser request immediately, which is not the case when using CSS as a static file.

  • #7 / Apr 08, 2009 2:17pm

    Danny T.

    426 posts

    NateL and grumps:

    There is an extension available for Firefox that allows you to launch an external application to edit text boxes from Firefox. It displays a little “Edit” icon to the side of the text box and once clicked, launches your application of choice, saving you a bit of time and making your workflow a bit better.

    The application is called It’s All Text!. Hopefully this helps resolve some of your issues and gives you some more options.

    Hope this helps.

  • #8 / Apr 08, 2009 2:33pm

    grrramps

    2219 posts

    The application is called It’s All Text!. Hopefully this helps resolve some of your issues and gives you some more options.

    Looks sweet, especially for code editing. The advantage of CSSEdit (and why it’s so highly acclaimed among Mac users) is the ability to edit CSS and preview the changes in real time (though not on a live site). That adds a welcome dose of productivity to CSS chores.

  • #9 / Apr 08, 2009 2:50pm

    NateL

    248 posts

    @Danny,
    Thank you for the advice.

    @grumps
    copy/paste/update css template/switch back to main site tab/refresh/switch back to EE CP tab/modify some CSS/copy/paste/etc. etc. etc.

    does not seem efficient, in my mind. On a live server- I understand the benefits of being able to log into an AdminCP and make necessary changes to an already existing CSS file.  It’s quick and easy….

    but, I’m developing a CSS file from basically scratch and “all of 2 seconds” to do all of that switching around, IMO, will only slow the process and all of that clicking around will just irritate me.

    Save the CSS/refresh the page/modify the css/ save the ss/ refresh the page/etc. etc. etc. is all I’m after.

    Anyhow, I thank you for your time and feedback.  I do appreciate it 😊

  • #10 / Apr 08, 2009 11:10pm

    BC Team

    244 posts

    I do not want my CSS files turned into PHP files. I just want CSS files that I can manipulate and work with without having to update the database each time I make a change.

    Whether you use a EE template default.php or a static css file default.css you do not have to update the database each time you change your css. If the file is saved as a flat template you just edit/save/refresh.

    Plus, if you are using static css files I would put them in the themes directory so that you are not giving away the name of your system folder in when you link to the css file.

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

ExpressionEngine News!

#eecms, #events, #releases