在IIS7中编译Sass文件 [英] Compile Sass files in IIS7
问题描述
我在IIS7上编译Sass(.scss)文件时遇到问题.有什么简单的方法可以调用编译吗?我曾尝试添加MIME类型,但事实并非如此.工作.我是否必须安装IIS服务器以外的其他东西?
I have encountered a problem in compiling Sass (.scss) files on IIS7. Is there any simple way to invoke the compilation? I have tried to add the MIME type but it wasn't working. Do I have to install something additional to IIS server?
我还在Visual Studio上安装了Mindscape而不是SassyStudio插件,并且由于动态.scss编译,它确实有所帮助.保存.scss文件时,Mindscape会生成.css文件.但是,是否有可能在部署期间或在IIS服务器上运行这种编译?
I have also installed Mindscape instead of SassyStudio ad-on to Visual Studio and it did help because of dynamic .scss compilation. As you save .scss file, Mindscape generates .css file. But is there a posibility to run such compilation during deployment or on the IIS server?
推荐答案
首先,Sass是一个预处理程序,因此必须将其编译为CSS,以供浏览器和IIS使用.
Firstly Sass is a pre-processor, therefore must to be compiled to CSS to be used by the browser and IIS.
您有几种选择:
-
在Visual Studio中编译为CSS,然后将CSS添加到项目中.
Compile to css within Visual Studio and add the CSS to the project.
将构建服务器/进程编译为CSS,然后再部署到您的环境中.常用的方法是使用Grunt或Gulp脚本.
Have your build server/process compile to CSS before deploying to your environment. A common way to do this is with a Grunt or Gulp script.
使用用于Sass的BundleTransformer ,并使用.scss
文件.转换器将把编译后的包输出到CSS.
Use BundleTransformer for Sass and create bundles with your .scss
files. The transformer will output the bundle compiled to CSS.
这篇关于在IIS7中编译Sass文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!