Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Prerender static index.html #171

Closed
rburnham52 opened this issue Jul 12, 2016 · 3 comments
Closed

Prerender static index.html #171

rburnham52 opened this issue Jul 12, 2016 · 3 comments

Comments

@rburnham52
Copy link

Is it possible to use prerender on static .html files? eveything i have seen so far seems to trigger it from an ASP.net view.

We currently serve up several angular apps that are managed via bower. So they will be mapping asp.net mvc routes to specific index.html files.

i was thinking that there should be a way to do this through asp.net middle ware?

@SteveSandersonMS
Copy link
Member

Is it possible to use prerender on static .html files? eveything i have seen so far seems to trigger it from an ASP.net view.

Currently all the templates and samples do work by injecting prerendered content into a Razor view's output. I'm guessing you want one of these two alternatives:

  1. At build time, emitting static .html files to disk, containing the rendered SPA's HTML output. When loaded into visitors' browsers, it will be entirely static, non-interactive content.
  2. Or, your goal is to use prerendering at runtime to produce entire HTML documents, not involving Razor at all

If your requirement is (2), then that's something that others have requested too (see #182). We may implement something like that soon, or perhaps someone in the community will do so.

If your requirement is (1), then that's pretty unusual and hasn't been requested by anyone else. It would certainly be possible to do it by writing some custom code to invoke the prerendering APIs on your dev machines (e.g., from a command-line tool) and writing the output to disk. We don't have any plans to bake such a feature into the templates because it would be a very unusual use case and nobody else has asked for it. But I'm sure you could figure out a way if it's important to your project.

@SteveSandersonMS
Copy link
Member

BTW if I'm misinterpreting your requirement, please re-open and clarify what you're looking for that might be different from the two options I've mentioned above :)

@rburnham52
Copy link
Author

rburnham52 commented Jul 18, 2016

@SteveSandersonMS its more along the lines of number 2. We have static html files for our angular apps that we serve up with asp.net but not via razor. we would use ASP.net more for a backend web api and server site routing.

so i would imagine you would have some sort of middle ware for the routes that would use prerender on the way out.

For example we have 2 different angular apps. / maps to index.html for the root app and /MyAccount maps to /MyAccount/index.html

I'm assuming prerender within node normally intercepts the output of each request, similar to filters or the new middleware in asp.net core?

each app has various routes and pages but they are relative to the base url of the app

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants