简体   繁体   English

从scss生成css

[英]generate css from scss

I have scss and css files in ASP.NET project. 我在ASP.NET项目中有scss和css文件。

截图

If I change scss, should be css be regenerated? 如果我更改了CSS,是否应该重新生成CSS? If yes, then how? 如果是,那怎么办? VS can do this or should I have some other tool? VS可以做到这一点,还是我应该拥有其他工具?

There are extensions that allow you to regenerate from inside Visual Studio, but I personally prefer the command line way. 有一些扩展允许您从Visual Studio内部重新生成,但是我个人更喜欢命令行方式。

sass --watch [folder holding .scss files]:[folder holding .css files]

If you use Compass, you can use this command instead: 如果使用指南针,则可以改用以下命令:

compass watch

Both of these commands will tell Sass to watch the folder with the .scss files, and any time they're changed and saved, regenerate the CSS files. 这两个命令都将告诉Sass使用.scss文件监视文件夹,并且每当更改和保存它们时,都将重新生成CSS文件。

If you created the project, then you likely already have Sass (and, by extension, Ruby) installed. 如果创建了项目,则可能已经安装了Sass(以及扩展名Ruby)。 If you don't, you'll need to install Ruby and Sass. 如果不这样做,则需要安装Ruby和Sass。 Windows has a nice little installer that installs both Ruby and RubyGems. Windows有一个不错的小安装程序 ,可以安装Ruby和RubyGems。 Once it's installed, you'll need to run the following to install Sass: 安装完成后,您需要运行以下命令来安装Sass:

gem install sass

Once Sass is installed, you can either run the sass --watch command, or use a VS extension of your choice to watch and recompile the CSS files. 一旦安装了Sass,您就可以运行sass --watch命令,或使用您选择的VS扩展名来监视和重新编译CSS文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM