Question

I'm interesting for simple solution for preprocessing of HTML files in .NET world. Here is an example of template I found in preprocess package for gruntjs:

<head>
  <title>Your App</title>
  <!-- @if NODE_ENV='production' -->
  <script src="some/production/lib/like/analytics.js"></script>
  <!-- @endif -->
</head>
<body>
  <!-- @ifdef DEBUG -->
  <h1>Debugging mode - <!-- @echo RELEASE_TAG --> </h1>
  <!-- @endif -->
  <p>
  <!-- @include welcome_message.txt -->
  </p>
</body>

Of course, I can render it in cshtml, but I'm just interesting is it possible to generate static content on post build action (just by pressing F6 and everything nice) the similar way?

The solution looks close to the aim it is using T4 templates. But it is not so elegant and simple as the language above.

The second solution is to install gruntjs, but it is not convenient to install this one to multiple dev machines and just simply looks weird in .NET world (where we have MSBuild, NAnt and powershell).

Any other ideas how to do not reinvent a bycle:)?

P.S. Please don't ask me why the question is so weird and why I just don't want to relax and get pleasure from cshtml:). I just have a research question that can be also interesting for other people (for example, in SPA I have only one such file and there is no reason to use server and make all the client hardly dependent from .NET).

Was it helpful?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top