Where should site objects be placed in an MVC website?
The examples given are from Kohana 3 , but the question is not limited to the scope.
I have always put my assets in a file structure like this
application
- classes
- views
assets
- css
- js
- swf
- images
-- layout
-- content
system
- classes
I started reading a few forums where people always mention that their resource files are put into a folder views
. This makes a lot of sense to me since these files are closely related to views (including markup). Also, it will close docroot.
What is the preferred location for site assets? If I place them in a folder views/assets
where the actual template files should be ... under a separate folder for example views/templates
?
a source to share
I try to host mine on the root webserver (wherever defined by the framework) so that I can link to /assets/img/myimage.jpg
(or a similar CSS / JS file, etc.). As Richard suggests, however, I'm doing this because I'm sticking to a framework agreement. I am not familiar with Kohana, but in the frameworks I have made extensive use of all resources in the default root directory.
a source to share
For ASP.NET MVC
The project template gives you folders ~\Content
and ~\Scripts
, with the latter containing jQuery.
Why not follow this model by adding additional folders to it if they would otherwise get too many items.
I would stick with the project template unless it has a good reason to override it (as well as override the logic for finding views and controllers).
a source to share