Web 2.0 PHP MySQL Drupal LAMP Web Development Consulting Theme Development

CSS Rules project

http://drupal.org/project/css_rules (new project page)

I have been using a pretty cheap method of add stylesheets for sometime. Right now I have a couple template functions that basically look at the current path and if there is a stylesheet with the same name it loads it. So if you are on the path "about" and it finds an about.css in the theme folder it adds a CSS reference to the head. Not real complicated but not real robust either.

So fast forwar to now. I have created a simple module that adds CSS references based on paths, similar to how it loads blocks. Add rules that are exclusive or inclusive. For example, you can add a rule for the bluemarine theme that loads "node.css" in your theme folder for paths "node*" and I added an ignore path for "node*edit" so that it won't load node.css on those pages -- pretty cool aye?

I've looked around for a module that already does this but have come up empty. I am really surprised there isn't anything like it already (let me know if you find something!).

This module is pretty simple, I based it off of Node Breadcrumb and Secure Pages. It doesn't allow editing rules and I really should add the ability to add JS scripts the same way.

First I would like a couple volunteer testers to check it out and also I want to make sure there isn't a module already out there. If there isn't then I will open source this module on drupal.org here pretty soon.

Rev 2

In version 2 I added js support to add script references instead of stylesheet references if the extension is .js. I also added the ability to to edit rules. I think I got something. I believe I'm going to open source it.

New Releases

http://drupal.org/project/css_rules

I already had Drupal CVS access so I decided to go ahead and deploy the module to the CVS repository. The dev release should be up soon and I think after I get some testers and/or get a site live with this module that I will tag a production release. I hope this helps someone out there. Enjoy!

AttachmentSize
css_rules.zip9.24 KB
css_rules v2.zip9.64 KB