1

Is there a way to split a single HTML page (purely static, HTML + JS) in VS2010 (I use VS2010 + ReSharper for my HTML /Js coding) into parts, but get / build a single page at build time.

There was such a feature with Dreamweaver (I have used this years back, think it called libraries). If I was using PHP I'd use something like Include at runtime.

My page contains several div sections serving as tabs, only one visible at time. I want to place the code between these tabs in a single file, to make it easier to maintain. But in the end I do need one single, static HTML file. Again, I want to do this a build time, not at server side.

<DIV>
  many lines of HTML
</DIV>

should be replaced by something like

<DIV>
  #include tab1.html
</DIV>

I could write a script building the static page and hook it into VS2010, but is there some extension or function already existing?

-- Follow ups on using T4 ---

  1. VS2010 - Assign html code formatting to T4 (.tt) file
  2. VS2010 - disable validation for particular html file (not all files)
Community
  • 1
  • 1
Horst Walter
  • 13,663
  • 32
  • 126
  • 228

1 Answers1

1

I ran across this question while searching for something else. You've probably moved on, but what the heck, maybe the answer will help someone else:

You could get so-called T4 templates to do this:

http://msdn.microsoft.com/en-us/library/bb126445.aspx

Alternately, Microsoft has similar capabilities in Razor, and it's more specific to HTML.

Here is a comparison of the two:

http://blogs.msdn.com/b/garethj/archive/2011/03/11/t4-vs-razor-what-s-the-skinny.aspx

McGuireV10
  • 9,572
  • 5
  • 48
  • 64