Sublime Forum

Laravel Blade snippets.json

#1

Hi
I’m trying to add some Laravel Blade snippets to my snippets.json file and not getting very far.

I suspect it’s to do with the ‘key’ I’m using (blade.php in example below) to indicate the snippets are for blade files? I’ve also tried text.blade which is the correct scope for a .sublime-snippet file but that doesn’t work either.

Here’s what I’ve got:

...
"blade.php": {
  "extends": "php",
  "snippets": {
    "{!!"      : "{!! $1 !!}$2",
    "@php"     : "@php\n$1\n@endphp",
    "@if"      : "@if\n$1\n@endif",
    "@foreach" : "@foreach\n$1\n@endforeach",
    "@while"   : "@while\n$1\n@endwhile"
  }
}
...

Anyone got blade snippets working in snippets.json file?
Cheers
James

0 Likes

#2

I’m also interested in this, never got it working correctly!

0 Likes

#3

Is this “snippets.json” file supposed to be interpreted by Sublime Text? Snippets for ST look as follows:

https://sublime-text-unofficial-documentation.readthedocs.io/en/latest/extensibility/snippets.html

If this is part of some package, you’ll likely have to compile the actual snippets from this custom template file first.

0 Likes