简体   繁体   中英

compiling HTML fragments for Single Page Application (SPA)?

Javascript Single Page Applications (SPA's) make it possible to create powerful web applications with simple technology. As an SPA becomes bigger, it seems you would need to have a way to separate the content in multiple html (and javascript an css) files to keep things manageable and maintainable.

All examples of how to make such a bigger application seem to make use of a separate templating mechanism such as JSP or Asp.net MVC, to combine html fragments into a single html page served to the client. To me this seems like overkill for an SPA, so that leads me to the question:

Is there a framework or tool(set) that allows me to compile html fragments into an html file that I can deploy to a static web server without requiring a dynamic server like IIS or Tomcat?

The assumption here is that there is a web (REST) API available for the SPA to talk to.

Have you had a look at these types of frameworks / libraries?

To name but only those i'm aware of.

You should check out http://boilerplatejs.org/ - it implements the MVVM pattern and utilizes RequireJS and its text plug-in to neatly break out your views, styles, and view models.

I use this in an Asp.Net MVC 4 solution. Durandal is another option, in fact John Papa has recently put out a Visual Studio template called Hot Towel . That's also another option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM