CSS and JS file naming convention

Topics: General, Writing modules, Writing themes
Nov 6, 2011 at 4:28 PM

I really couldn't filter out naming conventions from built-in modules, as I've seen at least two for both file types: PascalCase and separated-by-dashes (where the name uses the following form: [module name prefix]-[module name]-everything else). Either way, in the case of js files, the naming was not in direct connection with the names of the data structures used in the file (e.g. if there was only one class or one jQuery extension, its name was not the same as the file's name). I guess there is no docs about this topic?

AFAIK there is one barrier when naming stylesheets (maybe also js files?): the file name should be unique across the site, as the ResourceManager handles them this way.

Another topic would be the naming of resource entries. I've seen various approaches here too.

I know this is not a topic of great importance, but I'd like to go with a consistent convention. Could somebody give a definite answer?

Nov 7, 2011 at 6:24 PM

Not sure I understand what kind of convention you are asking about.

Nov 7, 2011 at 6:35 PM

About the naming conventions for js and css files and about their corresponding resource entries (specified in the ResourceManifest). Thanks!

Nov 7, 2011 at 7:26 PM

We can't really impose anything here: these files often preexist Orchard.

Manifest entries are another matter. We've been using simple names so far, because resources are really meant for shared resources, so there should be no ambiguity: everybody should agree what "jquery" is for example, it's kind of the point of having declared resources.

Nov 8, 2011 at 5:59 PM

Thanks! I though there is some conventional pattern for naming stylesheets (seeing most of the Orchard modules follow the pattern [ModuleName]-..., optionallly -admin at the end if it's an admin style) or javascripts.