programing

Sublime Text 2에 대한 Sass 지원?

nasanasas 2020. 11. 10. 08:14
반응형

Sublime Text 2에 대한 Sass 지원?


Sublime Text 2 에서 Sass 를 편집하기위한 기존 패키지가 있습니까?

이것은 인기있는 것 같습니다 : https://github.com/n00ge/sublime-text-haml-sass

그러나 설치 후에는 scss파일에 대한 구문 강조 만 제공하는 것으로 보입니다 .

이상적으로는 구문 강조 표시, 들여 쓰기 및 sass구문 완성을 원합니다 .


SASS / SCSS와 호환되는 놀라운 코드 완성을 위해서만 https://github.com/nathos/sass-textmate-bundle을 사용하는 것이 좋습니다 .

패키지에 대한 의심, 그리고 가정에서 당신이 놀라운 숭고한 사용할 때마다 패키지 제어를 그냥 사용 패키지 목록 , 유형 뭔가를 (결과는 설치 수에 의해 정렬됩니다), 일반적으로 가장 인기 하나는 최고의 하나입니다.


scss 파일에서만 작동하는 이유는 Ruby HAML 강조 표시 설정이 sass 강조 표시를 재정의하기 때문입니다.

고토 Preferences>Browse Packages...

폴더 Ruby Haml.tmLanguage내에서 찾기 및 열기Rails

fileTypes를 다음에서 변경하십시오.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>fileTypes</key>
    <array>
        <string>haml</string>
        <string>sass</string> <!-- This line is causing the problem -->
    </array>
    <key>foldingStartMarker</key>
    <string>^\s*([-%#\:\.\w\=].*)\s$</string>
    <key>foldingStopMarker</key>
    <string>^\s*$</string>
...

에:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>fileTypes</key>
    <array>
        <string>haml</string>
    </array>
    <key>foldingStartMarker</key>
    <string>^\s*([-%#\:\.\w\=].*)\s$</string>
    <key>foldingStopMarker</key>
    <string>^\s*$</string>
...

이제 설치 한 SASS 강조 표시 패키지가 제대로 작동합니다.


나는 최근에 이것에 대한 블로그 게시물을 작성했습니다 : How to Add SASS Support to Sublime Text .

다음은 간단한 요약입니다.

  • 구문 강조를 얻으려면 단순히 패키지 제어에서 호출 되는 sass-textmate-bundle 플러그인을 설치하십시오 Sass. 당신은 찾을 sass파일이 제대로 기본적으로 강조되지 않지만 포스트 I 세부에서 두 번째 수정 고상의 기본 플러그인 중 하나를 해킹 포함되지 않습니다.
  • SASS Build 플러그인설치하여 Sublime에서 빌드 sassscss파일 을 활성화 합니다.
  • 파일에 변경 사항을 저장할 때마다 자동으로 빌드를 실행하는 SublimeOnSaveBuild 플러그인을 추가 합니다.

자세한 내용 블로그 게시물확인 하세요.


이 기사 와 관련하여 :

  1. sass-textmate-bundle 플러그인 설치
  2. sass 파일 열기
  3. click View | Syntax | Open all with current extension as … | Sass

If a package conflict is causing trouble ( like the Haml issue ) and you need to edit / override a package like removing the <string>sass</string> part from the Ruby HAML file, then I would highly recommend the Package Resource Viewer (and editor) plugin.

  1. Install PackageResourceViewer
  2. Use the palette to do PackageResourceViewer: Open Resource:



  3. Select Rails then Ruby Haml.tmLanguage:

    screen-2014-02-25_10.37.09.png
  4. Comment out the offending line:

    screen-2014-02-25_10.39.12.png

  5. Save the file ( this is the awesome part, because the PackageResourceViewer automatically saves just the overridden part automatically to the correct place.

  6. Done.

Now go and tweak all the little settings / defaults in the other packages that have been annoying you.


I ran into the problem of https://github.com/n00ge/sublime-text-haml-sass not recognizing Rails default .css.sass files because of the extra .css extension. I agree with Maxime above that using https://github.com/seaofclouds/sass-textmate-bundle is a better option and that installing via the package control is ideal http://wbond.net/sublime_packages/package_control. The way to fix the .css.sass extension not being recognized is to edit the Sass package directly. Go to Sublime Text 2 > Preferences > Browse Packages and edit the Sass\Syntaxes\Sass.tmLanguage file. Add <string>css.sass</string> to the <array> block.

<key>fileTypes</key>
<array>
  <string>sass</string>
  <string>css.sass</string>
  <string>scss</string>
</array>

참고URL : https://stackoverflow.com/questions/11309185/sass-support-for-sublime-text-2

반응형