简体   繁体   English

如何在Visual Studio中创建加载项以从设置文件生成javascript,CSS和其他代码

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

My VS 2010 ASP.Net Web App project would have: 我的VS 2010 ASP.Net Web App项目将具有:

1. Settings file (names of actions, behavior, location of an image in an image cluster, etc.) 1.设置文件(动作名称,行为,图像在图像集群中的位置等)
2. A javascript containing functions for the actions to use. 2.一个JavaScript,其中包含要使用的操作的功能。 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. 该文件将在构建时与其他javascript文件合并在一起,并且每次都可以覆盖,因为生成后不需要在此处自定义任何内容。
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. 3.一个CSS文件,其中包含诸如DIV的背景属性之类的信息,我将其用作按钮以偏移到图像群集内的某个位置。

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. 我可以通过Visual Studio UI轻松触发的插件或某些命令/实体,以处理设置并为设置中指定的动作重新创建包含javascript和css的文件。 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. 我想要这个的原因是因为我将来会有30多个动作,并且可能还会更多,并且不想在我改变它们的工作方式并能够轻松添加新动作并具有JS和CSS很快重新生成。

You can use T4 templates. 您可以使用T4模板。 They can generate any text file based on the template that is written as a mixture of plain text and C#. 他们可以基于纯文本和C#混合编写的模板生成任何文本文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Visual Studio中保存时从文本文件生成普通的旧代码? - How can I generate plain old code from a text file on save with visual studio? 如何为Visual Studio 2008插件创建安装程序? - How do I create an installer for Visual Studio 2008 addin? 如何从Visual Studio 2012中编写的C#代码生成Visio 2010中的UML图? - How can I generate UML diagrams from C# code written in Visual Studio 2012 into Visio 2010? 如何在Visual Studio中生成项目的设置设计器文件 - How to generate a project's settings designer file on build in Visual Studio 如何为Visual Studio IDE的特定文件类型创建代码生成器? - How can I create a code generator for specific file types for the Visual Studio IDE? 如何在Visual Studio中为多个应用程序创建安装文件? - How Can I Create a Setup File for multiple applications in Visual Studio? 如何创建自定义工具以在Visual Studio 2010中生成代码? - How to create a custom tool to generate code in Visual Studio 2010? 如何在VS中更改proj文件的设置? (VS-AddIn) - How can I change the settings of a proj file in VS? (VS-AddIn) 如何在Visual Studio中为getter和setter以及构造函数自动生成标准代码? - How can I auto generate standard code for getters and setters and constructors in Visual Studio? 如何从代码生成CREATE TABLE脚本? - How can I generate CREATE TABLE script from code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM