CSS 如何在 Sublime 3 中设置 scss 语法?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42159810/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 12:24:53  来源:igfitidea点击:

How to set scss syntax in Sublime 3?

csssasssublimetext3sublimetextsyntax-highlighting

提问by user31782

I'm using Sublime 3 editor. When I open a SCSS file it shows many red characters because it misjudged the syntax. When I press CTRL+ Shift+ Pand type sassor scssI get no option. I had to set syntax to CSS.

我正在使用 Sublime 3 编辑器。当我打开一个 SCSS 文件时,它显示了许多红色字符,因为它错误地判断了语法。当我按CTRL+ Shift+P并输入sassscss我没有选项时。我必须将语法设置为 CSS。

Is there any way to set syntax to SCSS in Sublime 3?

有没有办法在 Sublime 3 中将语法设置为 SCSS?

回答by codegeek

press CTRL+ Shift+ Pin Submile Text below popup opens

在弹出窗口下方的 Submile Text 中按CTRL+ Shift+P

enter image description here

在此处输入图片说明

Click on the Package Control: Install Package.which will open the below popup.type SCSSin the search box.the first suggestion will be SCSS(It is not highlighted in the below image) and click on it.

单击Package Control: Install Package 。这将打开下面的弹出窗口。在搜索框中键入SCSS。第一个建议将是SCSS(下图中未突出显示)并单击它。

enter image description here

在此处输入图片说明

again press CTRL+ Shift+ Pand search for SCSS and click on the Set Syntax: SCSS. that it your scss files will be colored accordingly

再次按CTRL+ Shift+P并搜索 SCSS 并单击Set Syntax: SCSS。您的 scss 文件将相应地着色

enter image description here

在此处输入图片说明

回答by jameslol

There are two very popular packages: 'Sass', and 'SCSS'. I started with the 'SCSS' package, given that codegeek's 72+ answer suggests it, but I found that a large amount of my valid SCSS was just white.

有两个非常流行的软件包:“Sass”和“SCSS”。我从“SCSS”包开始,考虑到 codegeek 的 72+ 答案表明它,但我发现我的大量有效 SCSS 只是白色的。

The 'Sass'package contains both Sass and SCSS, and is much more complete for SCSS than the package just called 'SCSS'.

“萨斯”包包括萨斯和SCSS,是SCSS更完整的不仅仅是所谓的“SCSS”包。

Steps to install:

安装步骤:

  1. CTRL+SHIFT+P(Mac: COMMAND+SHIFT+P)
  2. Type 'Package Control: Install package' and press Enter. Wait several seconds
  3. Type 'Sass', ensure the selected item is just 'Sass', and press Enter.
  4. You'll see installation status in the status bar at the bottom of the app. When finished installing:
  5. CTRL+SHIFT+Pagain
  6. Type 'Set syntax: SCSS' and press Enter
  1. CTRL+ SHIFT+ P(Mac: COMMAND+ SHIFT+ P)
  2. 键入“ Package Control: Install package”并按Enter。等待几秒钟
  3. 键入“ Sass”,确保所选项目只是“ Sass”,然后按Enter
  4. 您将在应用底部的状态栏中看到安装状态。安装完成后:
  5. CTRL+ SHIFT+P再次
  6. 输入“ Set syntax: SCSS”并按Enter

回答by Ryan Wheale

If you have the Sass extension installed (which supports both SASS and SCSS) and you want all .scssfiles to open with the newer SCSS syntax highlighting rather than the older SASS, then do the following:

如果您安装了 Sass 扩展(支持 SASS 和 SCSS),并且您希望所有.scss文件都使用较新的 SCSS 语法突出显示而不是旧的 SASS 来打开,请执行以下操作:

  • Open View -> Syntax -> Open all with current extension as...
  • Select Sass -> SCSS
  • 打开视图 -> 语法 -> 以当前扩展名打开所有...
  • 选择Sass -> SCSS

Credit: http://joncaveman.com/2015/08/11/sublime-text-3-default-syntax-highlighting-for-file-types/

信用:http: //joncaveman.com/2015/08/11/sublime-text-3-default-syntax-highlighting-for-file-types/