Skip to content

SublimeText/Blade

Repository files navigation

Blade

Laravel Blade Template syntax definitions for Sublime Text based on its HTML/CSS/JS syntaxes.

It is a fork of great Medialink/Laravel Blade Highlighter which is no longer maintained.

Installation

Package Control

The easiest way to install is using Package Control. It's listed as Laravel Blade.

  1. Open Command Palette using ctrl+shift+P or menu item Tools → Command Palette...
  2. Choose Package Control: Install Package
  3. Find Laravel Blade and hit Enter
  4. Restart Sublime Text (e.g.: if A File Icons is installed)
  5. Reopen any .blade files.

Manual Install

  1. Download or clone this repository into [install-dir]/Packages/Laravel Blade
  2. Restart Sublime Text (e.g.: if A File Icons is installed)
  3. Reopen any .blade files.

Note

Syntax from main branch require Sublime Text 4.

For Sublime Text 3 compatible version refer to st3 branch.

Supported Extensions

Troubleshooting

§1 Syntax Definition Parse Errors

Blade extends Sublime Text's HTML syntax definition.

If Blade syntax highlighting doesn't work and console displays syntax errors in HTML (Blade).sublime-syntax, please make sure to remove any out-dated syntax override.

Steps:

  1. call Menu > Preferences > Browse Packages..
  2. Look for HTML folder
  3. Remove it or at least delete any syntax definition in it.

§2 Scripts are not correctly highlighted

Blade relies on JavaScript (source.js), JSX (source.jsx), TypeScript (source.ts) and TSX (source.tsx) 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.ts") in ST's console.

Known candidates are:

How to Contribute

  • To test a local version of the highlighter first uninstall the highlighter from package control.
  • Follow the manual installation process by cloning the repo into your packages directory.
  • Restart Sublime Text.
  • Open up the '[install-dir]/Packages/laravel-blade' folder into a new Sublime Text project.
  • Open up the blade.tmLanguage file and make changes.
  • I have provided a test.blade file that holds most of the common uses for testing the regex, use this to verify your changes before and after you make them to ensure the changes you make do not break anything.
  • Send a pull request with a single change per request.