Compile Sass files in IIS7

2019-08-09 10:21发布

问题:

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?

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?

回答1:

Firstly Sass is a pre-processor, therefore must to be compiled to CSS to be used by the browser and IIS.

You have a few options:

  1. Compile to css within Visual Studio and add the CSS to the project.

  2. 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.

  3. Use BundleTransformer for Sass and create bundles with your .scss files. The transformer will output the bundle compiled to CSS.