Dump my MVC site for static files

I want to create a simple site with MVC, and then display the “pages” and the corresponding “assets” (js, css, images, etc.) for what can be called a “static site”.

In other words, I do not want to deploy an IIS server with MVC support. I just want to create a site in MVC, and then somehow parse these pages into static html / css / etc files and upload the site to a regular LAMP host.

Is there an easy way to automate this? NuGet Package? Binary? An MVC extension, for example, could be a handler extension that can render a static site in one go?

+4
source share
4 answers

About 10 years ago, I downloaded entire sites for offline use with the HTTrack Website Copier. Perhaps you can upload your own website, which will give you a good hierarchy of your static web pages. If you think that all your web pages are accessible through links to the main page, links in the menu, etc., you can download most of your site. You can mainly use Google for web crawlers / standalone browsers / website downloaders, etc. And run them to do their job.

Alternatively, if you know the URL pattern, you can send it to the download manager to download it. Not sure if it works with your site, but sometimes I do it.

NTN

+2
source

You can watch Pretzel , a static .Net site generator.

Update: Apparently, it does not work on ASP.Net projects: Issue No. 123 . It only supports the Razor language for creating content pages.

+1
source

If your site depends on a database or some other dynamic source, it is almost impossible to dump all possible page combinations into static files. If, on the other hand, your site is largely static, saving the displayed HTML / JS / CSS source to files and uploading it to the LAMP server will not be too complicated.

0
source

If the reason for this is performance related, then why not just use output caching, etc., so the pages will be extremely fast (you can set the cache timeout for a very long period of time), and you don’t need to run any either a conversion tool and keep your html separate from the source code.

Of course, you still need to run IIS / .net

0
source

All Articles