c# - Can you open a view in asp.net MVC that does not have the view engine's extension? -


i want include code in javascript file inside of asp.net mvc page view (the view javascript result described here. want consolidation reasons javascript, lower loading overhead of complex gui ria, make compression more efficient, , make debugging easier.

the issue using ext designer create gui. every time project exported creates 2 .js files per class, , since gui pretty complex have quite lot of .js files already.

so idea consolidate (at runtime) javascript files 1 have main javascriptviewresult razor view contain html.renderpartial() view calls .js files.

however, if call html.renderpartial("gui/baselayout.js"), exception because tries find "gui/baselayout.js.cshtml".

is there way force asp.net mvc not add view engine's extension renderpartial call, or there better way concatenate .js files 1 outputted script file?

you can try writing own extension method htmlhelper reads in .js files , concatenates them. doing per-request can bit costly.

a second choice use tool chripy (chirpy.codeplex.com). visual studio add-on (not plugin, should work express editions). meant compiling .less files, can lot more. can example make .chirp.config file looks this:

<?xml version="1.0"?>  <root>             <filegroup name="main.scripts.js">          <folder path="/" type="*.min.js" minify="false"/>          <file path="microsoftajax.js" />      </filegroup>  </root> 

if put in scripts folder find .min.js files , microsoftajax.js file , add them main.scripts.js file. have make bit more complex handle of .js files, @ least precompiled.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -