[RESOLVED]Sharing code between ASP.NET MVC project and Cordova project

I am developing a Cordova based mobile app via Visual Studio’s Cordova template as well as an ASP.NET MVC web application in the same Visual Studio solution.  I’d like to be able to share as much HTML between both projects as possible.  One issue I am running
into is the bundling and minification that takes place in ASP.NET that is not available in the Cordova project.  Any ideas how I could support minification within Visual Studio across both projects that would allow me to share as much code as possible?

Hi Chicago,

As far as I know the Bundling and Minification is used in ASP.NET 4.5 to improve request load time.

If you want to use the bundled and minified files, you could have a view to load these files in the MVC project, then in the Cordova project, you could request that view to get those files.

For the independent projects, we should base on the request to share the data.

Best Regards

Starain

the current version of MVC bundling is done at runtime, which as you found doesn’t help with Cordova. 

most of the javascript toolkits (including Cordova) use node.js with grunt or similar to build and min. you should probably switch to this model. there are several Cordova plugins to minify. I have only done Cordova development on a Mac (best platform for
mobile work), but here is how to add grunt/etc added to visual studio as build steps.

   http://www.hanselman.com/blog/introducinggulpgruntbowerandnpmsupportforvisualstudio.aspx

note: there are lots of examples of building Cordova apps with grunt.

Leave a Reply