How can I create an addin in Visual Studio to generate javascript, CSS and other code from a settings file

StackOverflow https://stackoverflow.com/questions/17201861

Question

My VS 2010 ASP.Net Web App project would have:

1. Settings file (names of actions, behavior, location of an image in an image cluster, etc.)
2. A javascript containing functions for the actions to use. This file that will get combined in with other javascript files at build time and is OK to overwrite each time as I won't need to customize anything here after it's generated.
3. A CSS file containing information such as the background attribute for a DIV that I'm using as a button to offset into a location within an image cluster.

What I want is:

An addin or some command/entity that I can easily trigger via Visual Studio UI to process the settings and recreate the files containing javascript and css for the actions specified in the settings. The reason I want this is because I'll have 30+ actions and possibly more in the future and don't want to recreate these any time I make changes of how I want them to work and easily be able to add new ones and have the JS and CSS quickly regenerated.

Was it helpful?

Solution

You can use T4 templates. They can generate any text file based on the template that is written as a mixture of plain text and C#.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top