使用SASS与ASP.NET [英] Using SASS with ASP.NET

查看:1099
本文介绍了使用SASS与ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找如何使用 SASS (句法Awesome StyleSheets)从一个ASP.NET环境中的Ruby HAML包。理想情况下,我希望将SASS文件编译为CSS是构建过程的一个无缝的部分。



这种集成的最佳方法是什么?

解决方案

要获得更好的工作体验, Visual Studio中,您可以安装开始支持Sass(SCSS语法)的 Web Essential 的最新版本。
或者,您可以安装 Sassy Studio Web Workbench



然后在ASP中编译.sass / .scss文件.NET项目中,有一些不同的工具:通过 Web Essential Web Workbench SassC Sass.Net 指南针 SassAndCoffee ...






Web Essential 功能强大的Visual Studio插件,真正为所有前端内容提供更好的体验。最新版本开始支持Sass(SCSS语法)。内部使用Libsass将SCSS编译为CSS。






Web Workbench 是Visual Studio的另一个插件,它添加了语法高亮,intellisence和一些其他有用的东西编辑SCSS文件。它还可以将您的代码编译为正常或缩小的CSS。在内部它使用了一个包装版本的Ruby Sass编译器。






Sassy Studio :Visual Studio的另一个插件。






Libsass库 是Sass CSS预编译器(仍在开发中)的C ++端口。原始版本是用Ruby编写的,但是这个版本是为了提高效率和可移植性。该库致力于轻松,简单,易于构建并与各种平台和语言集成。



Libsass库周围有几个包装器:




  • SassC :命令行编译器(在Windows上,您需要使用MsysGit编译SassC的源代码来获取sassc.exe)。

  • NSass :.Net包装器。

  • Node-Sass :在Node.js上使用Libsass。

  • / ul>




    指南针 是Sass的一个框架,它添加了许多有用的帮助(如图像sprite),也可以编译你的SCSS / Sass。但是您需要在每个需要编译样式的开发环境中安装Ruby。






    SassAndCoffee 是通过一些DLL和配置添加SCSS / Sass编译和缩小支持的软件包。它优于Web Workbench编译器,它是自包含在您的Visual Studio解决方案中:您不需要在每个开发环境安装插件。备注:SassAndCoffee不经常更新,并且因为它使用IronRuby包装官方Ruby编译器,你可以得到一些性能问题。您可以通过 Nuget包安装最新版本。


    I'm looking into ways to use SASS (Syntactically Awesome StyleSheets) from the Ruby HAML package in an ASP.NET environment. Ideally, I would like compilation of SASS files into CSS to be a seamless part of the build process.

    What are the best ways to this integration? Alternatively, are there other CSS-generation tools that are better suited for a .NET environment?

    解决方案

    For a better working experience in Visual Studio, you could install the last version of Web Essential which is starting to support Sass (SCSS syntax).
    Alternatively you could install Sassy Studio or Web Workbench.

    Then to compile your .sass/.scss files in your ASP.NET project, there is some different tools: via Web Essential, Web Workbench, SassC, Sass.Net, Compass, SassAndCoffee...


    Web Essential a fully featured plugin for Visual Studio, which really give a better experience for all Front-End stuffs. The latest version is starting to support Sass (SCSS syntax). Internally it use the Libsass to compile the SCSS to CSS.


    Web Workbench is another plugin for Visual Studio that add syntax highlighting, intellisence and some other useful stuff for editing SCSS files. It can also compile your code into normal or minified CSS. Internally it used a wrapped version of the Ruby Sass compiler.


    Sassy Studio: another plugin for Visual Studio. Less featured but much lighter.


    The Libsass library is C++ port of the Sass CSS precompiler (still in development). The original version was written in Ruby, but this version is meant for efficiency and portability. This library strives to be light, simple, and easy to build and integrate with a variety of platforms and languages.

    There are several wrappers around the Libsass library:

    • SassC: a command line compiler (on Windows you need to compile the source of SassC with MsysGit to get the sassc.exe).
    • NSass: a .Net wrapper.
    • Node-Sass: to use Libsass on Node.js.
    • etc.

    Compass is a framework for Sass that add a lot of useful helpers (like image spriting) and can also compile your SCSS/Sass. But you need to install Ruby on each development environment where you need to compile your styles.


    SassAndCoffee is a package that adds SCSS/Sass compilation and minification support, via some DLLs and configs. Its advantage over the Web Workbench compiler is it's self-contained into your Visual Studio solution: you don't need to install a plugin on every development environment. Remark: SassAndCoffee is not often updated, and because it use IronRuby to wrap the official Ruby compiler, you can get some performance issues. You can install the latest version via a Nuget package.

    这篇关于使用SASS与ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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