Reputation: 397
So, guys, there's no secret for each of you that every view has certain list of CSS and JS files. There can be global scope files and corresponding for each view files that's required by only one view. So how do you guys manage CSS and JS list in your MVC project? Please advice me something efficient. Thanks!
Upvotes: 1
Views: 176
Reputation: 706
In most cases you would want to define your list of CSS and JS files within the master file appropriate for the view in question.
If however you have CSS/JS files that should only be included within a specific view, you may set up a content placeholder in your master file, and override it in your view. This post may in that case be interesting for you.
Regarding placement, I like to put all my CSS files in the content-folder that is generated for me when I create a new ASP.NET MVC project: project-name/content/css
JS files i put in the scripts directory: project-name/scripts
This way, there's never any doubt on where to put new CSS/JS files, and the project structure stays organized and uncluttered.
Upvotes: 1