.减少。net和Visual Studio中的css文件

时间:2022-09-01 22:47:58
  1. Is the recommended way of handling .less files to use pre-compiled static files or use some sort runtime conversion using for example a HttpHandler? What are the pros and cons of the different ways of doing it?
  2. 使用预编译静态文件或使用某种类型的运行时转换(例如使用HttpHandler)处理.less文件的推荐方法是什么?不同方法的优缺点是什么?
  3. What's the recommended techniques of solving the above suggested approach? Tools, libraries etc?
  4. 解决上述建议方法的推荐技术是什么?工具、图书馆等等?

1 个解决方案

#1


6  

Because you are on .NET, I recommend you check out the DotLess project. It's open source and very active. They have an HTTP Handler that plugs into IIS, it grabs any request for a .less file and returns a valid CSS file. I don't know what amount of caching they use, but you can probably rely on the browser to cache a good amount of it..

因为你在。net上,我建议你去看看DotLess项目。它是开源的,非常活跃。他们有一个插入IIS的HTTP处理程序,它获取.less文件的任何请求并返回一个有效的CSS文件。我不知道他们使用了多少缓存,但是你可以依赖浏览器来缓存大量的缓存。

The DotLess project also has an executable that will compile when you want (like during a project build), or on demand prgrammatically.

DotLess项目还有一个可执行文件,可以在你想要的时候编译(比如在项目构建过程中),或者按语法要求编译。

The pros and cons for which way you do it really depends on your project. I think the best workflow may be to use LESS.js for development because you don't need external dependencies besides the javascript file, and all the changes are live right away. Then as the project is promoted through various testing and production environments, you can install the web server filter or precompile it. Again, it depends on how you want to solve it for your project.

你用哪种方式做这件事的利弊取决于你的项目。我认为最好的工作流程可能是使用更少。用于开发的js,因为除了javascript文件之外,您不需要外部依赖,并且所有的更改都立即生效。然后,随着项目通过各种测试和生产环境得到提升,您可以安装web服务器过滤器或预编译它。同样,这取决于您希望如何为项目解决它。

#1


6  

Because you are on .NET, I recommend you check out the DotLess project. It's open source and very active. They have an HTTP Handler that plugs into IIS, it grabs any request for a .less file and returns a valid CSS file. I don't know what amount of caching they use, but you can probably rely on the browser to cache a good amount of it..

因为你在。net上,我建议你去看看DotLess项目。它是开源的,非常活跃。他们有一个插入IIS的HTTP处理程序,它获取.less文件的任何请求并返回一个有效的CSS文件。我不知道他们使用了多少缓存,但是你可以依赖浏览器来缓存大量的缓存。

The DotLess project also has an executable that will compile when you want (like during a project build), or on demand prgrammatically.

DotLess项目还有一个可执行文件,可以在你想要的时候编译(比如在项目构建过程中),或者按语法要求编译。

The pros and cons for which way you do it really depends on your project. I think the best workflow may be to use LESS.js for development because you don't need external dependencies besides the javascript file, and all the changes are live right away. Then as the project is promoted through various testing and production environments, you can install the web server filter or precompile it. Again, it depends on how you want to solve it for your project.

你用哪种方式做这件事的利弊取决于你的项目。我认为最好的工作流程可能是使用更少。用于开发的js,因为除了javascript文件之外,您不需要外部依赖,并且所有的更改都立即生效。然后,随着项目通过各种测试和生产环境得到提升,您可以安装web服务器过滤器或预编译它。同样,这取决于您希望如何为项目解决它。