Style and control script in Asp.Net MVC

I am currently using asp.net mvc 2.0 in my projects. I like the way asp.net mvc is designed and works, but I feel that it lacks support for applications with a lot of styles and scripts.

To isolate different parts of the application, I use areas, only child actions and partial ones. I would also like a standard way to separate my scripts and styles, i.e. putting my script and style files in an area (not in the script folder and contents in the root directory) and a good way to include them in the pages where they belong.

Currently, I am using the content owner on every page, in which I can include any script and styles for this action, but I would like to include a script method, for example. only for children.

What do you think about this, how do you manage your script and style files, are there any templates or best practices?

+3
source share
3 answers

You can use Chirpy (ehem): http://chirpy.codeplex.com/

Or SquishIt: https://github.com/jetheredge/SquishIt

Or create a controller that processes requests for js / css files: http://www.weirdlover.com/2010/05/10/zcontroller-asp-net-mvc-controller-fo-your-scripts-styles-images/

Or create an IHttpModule to handle js / css requests: How2: which event to enable the HttpModule to place js links in the head element

Not sure if this is what you are looking for. But all that I have.

+4

/css. . , , , . , . , " " " ", . .

, , YSlow.

,

+3

, , , . , .

+2

Source: https://habr.com/ru/post/1784099/


All Articles