Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax Highlighting for Laravel Blade Template Engine in Sublime Text 2

In Sublime Text 2, what steps do I need to take to get Syntax Highlighting for the Laravel Blade Template Engine to work?

As described in http://daylerees.com/2012/04/06/notable-blade-syntax-support-by-medalink/, I took https://github.com/Medalink/Laravel-Blade, unzipped it and copied the folder into Sublime's packages folder.

However, it doesn't seem to work (see screenshot), even if I set it manually using Tools\Command Palette...\Set Syntax: Blade

Is this only meant to work with particular Color Schemes (if so, which ones), or what am I missing? (I just started using Sublime Text today)

enter image description here

like image 702
Ben Avatar asked Jan 11 '13 13:01

Ben


People also ask

How do I enable syntax highlighting in sublime?

To enable Syntax Highlighting click on “View” in the top bar, then hover your mouse over “Syntax”, and select your programming language from the list. Alternatively, if you save a document with a supported file extension, Sublime Text 3 will automatically apply the Syntax Highlighting for that language.

How do you highlight text in Laravel?

use Illuminate\Support\Str; /* ... */ Str::macro('highlightSearch', function ($input, $searchString) { return str_replace($searchString, "<mark>$searchString</mark>", $input); //Or whatever else you do });

What is Laravel blade syntax?

The Blade is a powerful templating engine in a Laravel framework. The blade allows to use the templating engine easily, and it makes the syntax writing very simple. The blade templating engine provides its own structure such as conditional statements and loops.

Can I use Sublime Text for Laravel?

One of the most popular text editors used for coding is Sublime Text. Sublime has many features that make coding fun, and with plugins, we can add in Laravel-specific features to help with our app.


1 Answers

The easiest way to install plugins for Sublime Text 2 is through Package Control.

To install Package Control:

Installation is through the Sublime Text 2 console. This is accessed via the ctrl+` shortcut. Once open, paste the following command into the console:

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
This command creates the Installed Packages folder for you (if necessary), and then downloads the Package Control.sublime-package into it.

When you have Package Control installed all you need to do to install the Blade syntax highlighter is to:

  1. Open the command palette and type "install package"
  2. Press enter
  3. Wait for a new palette to show up after it has fetched the package list
  4. Type "blade syntax"
  5. Press enter
  6. Enjoy
like image 93
AndHeiberg Avatar answered Oct 30 '22 11:10

AndHeiberg