在运行时和编译时进行ASP.NET sass/scss编译? [英] ASP.NET sass/scss compilation at run-time and at compile-time?

查看:202
本文介绍了在运行时和编译时进行ASP.NET sass/scss编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在运行时和编译时编译.scss文件的解决方案.

I am searching for a solution for compiling my .scss files at run-time and at compile-time.

我需要两者的原因是我们的设计师可以在Mac上工作,并且更喜欢在运行时(尤其是在开发阶段)动态编译其.scss文件的便捷性.另一方面,我需要编译时支持来验证SCSS在构建过程中是否可以成功编译.我的目标是在SCSS无法编译的情况下使构建失败.

The reason I need both is that our designers work on Macs and prefer the ease of having their .scss files compiled dynamically at run-time (especially during a development phase). On the other hand, I need compile-time support to validate that the SCSS compiles successfully during my build process. My goal is to fail a build if the SCSS doesn't compile.

我在NuGet上发现了几个可用的库,但是每个库中的细微瑕疵都使我望而却步.

I have found several libraries available on NuGet, however, minor flaws in each of them are holding me back.

是否存在针对这两种情况的解决方案?

在这里,我的研究引领着我:

Here's where my research has led me:

运行时支持

  • BundleTransformer.SassAndScss via HttpHandler (works with Bourbon, albeit very slow)
  • Cassette.Sass (unable to compile Bourbon due to error)

编译时支持:

  • Cassette.MSBuild (Does not appear to bundle SCSS files, only CSS)
  • Mindscape Web Workbench (Pro version apparently includes a command-line tool, however, documentation is very limited on the feature)
  • Others?

推荐答案

Mindscape的专业版Web Workbench 包含用于在运行时进行编译的命令行工具.目前,只有每晚版本才能编译Bourbon和Neat(我的要求之一).

The Pro edition of the Mindscape Web Workbench includes a command-line tool for compiling at runtime. Currently, only the nightly build is capable of compiling Bourbon and Neat (one of my requirements).

这是我正在进行的预建活动,目前效果很好:

Here is my pre-build event which is working great at the moment:

"C:\Program Files (x86)\Mindscape\Web Workbench\Command Line\wwcmd.exe"
"$(ProjectDir)scss\style.scss" /o:../css /style:compressed

更新:

我们决定只从预构建事件中调用SASS,而不是使用Web Workbench.

We decided to simply call SASS from a pre-build event as opposed to using Web Workbench.

call sass -C "$(ProjectDir)assets\scss\main.scss" "$(ProjectDir)assets\css\compiled\main.css" --style compressed

这篇关于在运行时和编译时进行ASP.NET sass/scss编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆