Out of the box Sublime Text 3 does not colour HTML Twig syntax correctly.
At the point of writing this there doesn’t seem to be anything on Package Control that can do this.
![](http://sharpi.sh/wp-content/uploads/2018/02/Screen-Shot-2018-04-06-at-21.25.26.png)
![](http://sharpi.sh/wp-content/uploads/2018/02/Screen-Shot-2018-04-06-at-21.25.26.png)
To add correct syntax highlighting create a folder named “PHP-Twig” in
OSx
~/Library/Application Support/Sublime Text 3/Packages/
Windows
Sublime Text > Preferences >Browse Packages will open the Packages directory in Explorer.
Copy this .tmLanguage file on Github to the PHP-Twig directory you just created.
Open Sublime Text 3 and you should now have “HTML (Twig)” available in the file format choice menu at the bottom right of the window
Now your code looks nice.
![](https://sharpi.sh/wp-content/uploads/2018/02/better-twig.png)
![](https://sharpi.sh/wp-content/uploads/2018/02/better-twig.png)
Was this article helpful?
YesNo