Syntax Highlighting for Laravel Blade Template Engine in Sublime Text 2

25,083

Solution 1

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

Solution 2

For Sublime text 3 as well as sublime text 2

  1. install Sublime Package Control (more help on: http://wbond.net/sublime_packages/package_control/installation)

  2. then restart sublime text (2/3) and press ----> control (or command in mac) + shift + p

  3. there search for package control: install package

  4. wait for another interaction screen

  5. search for Laravel Blade (and other packages if you want)

{ For video tutorials on this and other , subscrive this channel : https://www.youtube.com/channel/UChEv_j3fE4k2r7KcEApFDyQ }

Solution 3

Also, once you have Package Control installed, you should also install the package 'DetectSyntax'. It will automatically detect the blade syntax so you don't have to manually set it for each file.

Share:
25,083
Ben
Author by

Ben

I have just finished a 4-year degree in Physics & Computer Science, and now I am looking to get more into programming. I have been doing Web-Development for seemingly forever. You can talk to me in HTML & CSS, and I also know one thing or another about JS, jQuery, PHP and MySQL. Currently, I am interested in simple 2D game development. I use C++, SDL and OpenGL.

Updated on July 12, 2022

Comments

  • Ben
    Ben almost 2 years

    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

  • Kreker
    Kreker about 11 years
    can't find it in the list:(
  • BSchlinker
    BSchlinker about 11 years
    @Kreker The package name has changed from DetectSyntax to ApplySyntax See here: github.com/facelessuser/ApplySyntax
  • Gerry
    Gerry almost 11 years
    Thank you, I already had it installed but thought I didn't because it wasn't auto applied :)
  • Jason Lewis
    Jason Lewis almost 11 years
    I think an update was pushed that changed a few things. Might need to uninstall it and make sure everything was deleted. Close and re-open ST2 and install again.
  • paoloumali
    paoloumali almost 11 years
    Actually, my gut feel was wrong. Although I did not take time pinpointing what the source of the problem was(leaning towards a rename of the package responsible of laravel highlighting), and my going to the Package Control.sublime-settings in wherever your OS is saving this file, was showing an entry for laravel-blade. All I needed to do was remove it from the JSON file. Voila, no errors, no need to reinstall.
  • giannis christofakis
    giannis christofakis almost 11 years
    At step 1 I'm typing install package and I get a SyntaxError.
  • AndHeiberg
    AndHeiberg almost 11 years
    @yannishristofakis I would have to guess that Package Control wasn't properly installed then. Try to install Package Control again and make sure you don't get any errors.
  • Hakim
    Hakim over 10 years
    Or you can download it from here: Source on github
  • iroel
    iroel over 10 years
    I've followed your tutorial and this link net.tutsplus.com/tutorials/tools-and-tips/… (to create dog resource) and it didn't generate anything. I'm using windows and sublime text 2. I've already add php executable in path environment, assoc .php to php executable. Did I miss something? Error detail: Traceback (most recent call last): File ".\generate.py", line 59, in call_artisan File ".\subprocess.py", line 633, in init File ".\subprocess.py", line 842, in _execute_child WindowsError: [Error 2] The system cannot find the file specified
  • Sagiruddin Mondal
    Sagiruddin Mondal over 10 years
    Brother Please make sure you have installed the package first. First google about how to install packages on Sublime (2 / 3) . You will get the installer code Here . All the best Bro \m/
  • Brendan Falkowski
    Brendan Falkowski about 10 years
    Built-in option: 'View > Syntax > Open all with current extension as... > PHP Laravel Blade'.