EJS syntax definition for Sublime Text based on its HTML, CSS and JavaScript syntax definitions.
Supported template tag variants are: <% %>
. <? ?>
.
The easiest way to install is using Package Control. It's listed as EJS
.
- Open
Command Palette
using ctrl+shift+P or menu itemTools → Command Palette...
- Choose
Package Control: Install Package
- Find
EJS
and hit Enter
- Download appropriate EJS.sublime-package for your Sublime Text build.
- Copy it into Installed Packages directory
Note
To find Installed Packages...
- call Menu > Preferences > Browse Packages..
- Navigate to parent folder
By default, files with the extension .ejs
are opened with the EJS (<% %>)
syntax.
To open files with a different extension as EJS, or to use delimiters other than <% %>
, follow these steps to set the default EJS syntax for a file extension:
- Open an EJS file
- Select
View
from the menu bar - Then select:
Syntax
→Open all with current extension as...
→EJS
→EJS (<delimiter>)
- Repeat for each extension you want to open as EJS
In the HTML scope:
if
+TAB
- Inserts EJSif
statementfor
+TAB
- Inserts EJSfor
loop
EJS extends Sublime Text's HTML, CSS and JavaScript syntax definition.
If EJS syntax highlighting doesn't work and console displays syntax errors in EJS.sublime-syntax, please make sure to remove any out-dated syntax override.
Steps:
- call Menu > Preferences > Browse Packages..
- Look for HTML, CSS or JavaScript folder
- Remove them or at least delete any syntax definition in it.
EJS relies on JavaScript (source.js
)
to scope script blocks and inline scripts.
Make sure to remove related out-dated syntax packages, which don't meet least compatibility requirements.
They can be identified by calling
e.g. sublime.find_syntax_by_scope("source.js")
in ST's console.
Known candidates are:
Most problems are best addressed by opening an issue.