将 scss 转换为 css
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13649471/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Converts scss to css
提问by Barbara
Does anyone know how can I convert this code to standard css? It's not working in their editor.
有谁知道如何将此代码转换为标准 css?它在他们的编辑器中不起作用。
回答by y8r
If you click on the title CSS (SCSS)
in CodePen (don't change the pre-processor with the gear) it will switch to the compiled CSS view.
如果您单击CSS (SCSS)
CodePen 中的标题(不要使用齿轮更改预处理器),它将切换到已编译的 CSS 视图。
回答by joshuahornby10
In terminal run this command in the folder where the systlesheets are:
在终端中,在 systlesheets 所在的文件夹中运行此命令:
sass --watch style.scss:style.css
Source:
来源:
When ever it notices a change in the .scss
file it will update your .css
当它注意到.scss
文件发生变化时,它会更新您的.css
This only works when your .scss
is on your local machine. Try copying the code to a file and running it locally.
这仅适用.scss
于您在本地计算机上的情况。尝试将代码复制到文件并在本地运行。
回答by dinindu
This is an online/offline solution and very easy to convert.SCSS to CSS converter
这是一个在线/离线解决方案,非常容易转换。SCSS 到 CSS 转换器
回答by Rahi.Shah
First of all, you have to install Ruby if it is not on your machine.
首先,如果你的机器上没有 Ruby,你必须安装它。
1.Open a terminal window. 2.Run the command which ruby.
1.打开终端窗口。2.运行命令which ruby。
If you see a path such as /usr/bin/ruby
, Ruby is installed. If you don't see any response or get an error message, Ruby is not installed.
To verify that you have a current version of Ruby,
run the command ruby -v
.
如果您看到诸如 之类的路径/usr/bin/ruby
,则 Ruby 已安装。如果您没有看到任何响应或收到错误消息,则说明未安装 Ruby。要验证您是否拥有当前版本的 Ruby,请运行命令ruby -v
。
If ruby is not installed on your machine then
如果你的机器上没有安装 ruby 那么
sudo apt-get install ruby2.0
sudo apt-get install ruby2.0-dev
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem2.0 1
After then install Sass gem by running this command
然后通过运行此命令安装 Sass gem
sudo gem install sass --no-user-install
Then copy or add any .sass file and go to that file path and then
然后复制或添加任何 .sass 文件并转到该文件路径,然后
sass --watch style.scss:style.css
When ever it notices a change in the .scss file it will update your .css
当它注意到 .scss 文件发生变化时,它会更新你的 .css
This only works when your .scss is on your local machine. Try copying the code to a file and running it locally.
这仅在您的 .scss 在您的本地机器上时有效。尝试将代码复制到文件并在本地运行。
回答by AmerllicA
You can use sass /sassFile.scss /cssFile.css
您可以使用 sass /sassFile.scss /cssFile.css
Attention: Before using
sass
command you must install ruby and then install sass.For installing sass, after ruby installation type
gem install sass
in your TerminalHint: sass compile
SCSS
files
注意:使用
sass
命令前必须先安装ruby,然后再安装sass。对于安装SASS,红宝石安装类型后,
gem install sass
在你的终端提示:sass编译
SCSS
文件
回答by Sagar Jadhav
Install Ruby-sass using below command
sudo apt-get -y update
sudo apt-get -y install ruby-full
sudo apt install ruby-sass
gem install bundler
使用以下命令安装 Ruby-sass
sudo apt-get -y update
sudo apt-get -y install ruby-full
sudo apt install ruby-sass
gem install bundler
Example
sass SCSS_FILE_PATH:CSS_FILE_PATH;
示例
sass SCSS_FILE_PATH:CSS_FILE_PATH;
e.g sass mda/at-md-black.scss:css/at-md-black.css;
例如 sass mda/at-md-black.scss:css/at-md-black.css;