Question

I'm using Enyo to build a web application; a "normal" way of organizing the files might look like this:

CSS: webapp/css
JS: webapp/js
Other stuff: webapp/assets

One of my co-workers had a seemingly good idea to co-locate the Javascript and CSS, so that a Javascript file (e.g. webapp/js/MyView.js) would have its CSS analog located in the same folder with it (webapp/js/MyView.css). This seemed like a good idea, but since I've never seen this done before I wanted to get a second opinion from the internets.

So, internets, is this a good way to organize Javascript and CSS code? Why/why not?

Was it helpful?

Solution

You can organize your stuff however you want obviously. I just think having css in a folder labeled js is pretty misleading. If you want to put them in the same folder, call it media or something, not the same name that everyone associates with javascript files.

Personally, I separate images, js, css into folders of those names and it works fine for me, and I think it is quite standard. Another method is media/js, media/css, media/images if you like. As I stated personal preference, but something understandable and consistent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top