17

I have sublime 2/3 and the colorize inside a :javascript block doesn't work fine.

The package is this https://sublime.wbond.net/packages/Haml

Actually they says that: "Text inside Ruby, ERB, Javascript, Sass, and CSS filters are now properly recognized so you get all the syntax highlighting, snippets, commands, etc." but in sublime it doesn't work.

5
  • Do you have "Ruby HAML" set as the syntax? What color scheme are you using? Commented Sep 17, 2013 at 22:00
  • yes, I already set "Ruby Haml" as the syntax and the color scheme is Monokai Commented Sep 29, 2013 at 16:02
  • Any improvement on this? :( Commented Nov 17, 2013 at 16:22
  • Can you post some sample code so we can see? Commented Aug 7, 2014 at 18:05
  • 3
    Any change on this? Highlighting in HAML :javascript blocks still not working? i.imgur.com/P6N3ObC.png Commented Mar 16, 2015 at 11:05

2 Answers 2

8

Sublime 3 comes with preinstalled Rails package. This package also contains "Ruby Haml" syntax, which does not highlight embedded js etc. If you press ctrl + alt + p and type haml you will probably see two Set Syntax: Ruby Haml, one from Rails package, one from Haml. You need the latter to be used.

The best solution for me was to install ApplySyntax and in it's user settings add the following:

    // Put your custom syntax rules here:
    "syntaxes": [
        {
            "syntax": "Haml/Syntaxes/Ruby Haml",
            "extensions": ["haml"],
            "rules": [
                {"file_name": ".*\\.haml$"}
            ]
        }
    ]
Sign up to request clarification or add additional context in comments.

Comments

3

https://sublime.wbond.net/packages/Haml (https://github.com/phuibonhoa/handcrafted-haml-textmate-bundle) (installed with Package Control) works for me.

Though it would be nice to use it as the default somehow...

3 Comments

Click the language menu in the lower-right corner and select Open all with current extension as..., then pick the language pack you want.
@dentarg, do you know how to make this default?
Nope, I don't, sorry :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.