This module is a developer-oriented module.

Whenever you build a site, you have to do a lot of customizations. This usually means creating a lot of .tpl.php files. And either a lot of css files, or a big one. Same for JS files. This usually gets messy fast enough and even though Drupal provides some ways to make it painless, it still is.

This module is for you if:

  • You have a lot of .tpl.php files in the same folder, you can't remember which field-- goes into which node-- or page--..
  • You have a huge CSS file and organizing is hard, you usually end up writing everything at the end of the file.
  • You have a lot of small CSS files to handle each part of the files. And you have to add each of them to the .info file. And you usually end up putting new stuff in a "put-it-all" CSS file because you can't remember what goes where.
  • You have a lot of small JS files and each of them ends up with a lot of unrelated stuff. Also, it's a pain to declare all the files in the .info file.
  • You have a huge JS file with everything in it.

Sounds familiar? Read on.

I had the same problem. Depending on the project I worked on, it always ended up in one of those situations.

Then, I read a blog post by TJ Holowaychuk: UI Components.

The idea is great. Basically, you separate each of your components' files in its own folder. A component can be a block, a carousel, a content type, whatever. Drupal provides enough ways to separate our concerns this way. Each component can have its own folder with a tpl.php file, a CSS file and a JS file. As simple as that. I can't believe I didn't think about it before.

But then, a burden came to mind: I will have to declare every single CSS and JS file in the .info file. If I want to separate concerns this way, I better find a way to automate this.

This is what this module is for.

Roadmap:

  • Caching strategy. (Aggregate for the whole site or aggregate only for this page?)
  • Recursively find files? (It might be useful not to look for JS files in sub folders if you want to load them yourself.)

Project Information

Downloads