Sublime Text 2 中 Laravel Blade 模板引擎的语法高亮显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14278935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:21:54  来源:igfitidea点击:

Syntax Highlighting for Laravel Blade Template Engine in Sublime Text 2

sublimetext2laravelsublimetext

提问by Ben

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

在 Sublime Text 2 中,我需要采取哪些步骤才能使 Laravel Blade 模板引擎的语法高亮显示工作?

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.

http://daylerees.com/2012/04/06/notable-blade-syntax-support-by-medalink/ 中所述,我将https://github.com/Medalink/Laravel-Blade 解压缩并复制将文件夹放入 Sublime 的包文件夹中。

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

但是,它似乎不起作用(见截图),即使我使用 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)

这是否仅适用于特定的配色方案(如果是,是哪些),还是我错过了什么?(我今天刚开始使用 Sublime Text)

enter image description here

在此处输入图片说明

回答by AndHeiberg

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

为 Sublime Text 2 安装插件的最简单方法是通过包控制。

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.

安装是通过 Sublime Text 2 控制台进行的。这是通过 ctrl+` 快捷方式访问的。打开后,将以下命令粘贴到控制台中:

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:

安装包控制后,安装 Blade 语法高亮器所需要做的就是:

  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
  1. 打开命令面板并输入“安装包”
  2. 按回车
  3. 在获取包列表后等待新的调色板出现
  4. 输入“刀片语法”
  5. 按回车
  6. 享受

回答by Sagiruddin Mondal

For Sublime text 3 as well as sublime text 2

对于 Sublime text 3 和 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)

  1. 安装 Sublime Package Control(更多帮助:http: //wbond.net/sublime_packages/package_control/installation

  2. 然后重新启动 sublime text (2/3) 并按 ----> control (or command in mac) + shift + p

  3. 在那里搜索包控制:安装包

  4. 等待另一个交互屏幕

  5. 搜索 Laravel Blade(如果需要,还可以搜索其他软件包)

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

{有关此和其他视频教程,请订阅此频道:https: //www.youtube.com/channel/UChEv_j3fE4k2r7KcEApFDyQ}

回答by Sean

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.

此外,一旦安装了包控制,您还应该安装包“DetectSyntax”。它将自动检测刀片语法,因此您不必为每个文件手动设置它。

回答by paoloumali

In case you installed the Laravel Blade Syntax Highlighter using Package control, that plugin, for some reason keeps throwing out errors.

如果您使用 Package control 安装了 Laravel Blade Syntax Highlighter,该插件出于某种原因会不断抛出错误。

Package Control: The package specified, laravel-blade, is not available

包控制:指定的包,laravel-blade,不可用

What I did is just Preference > Browse packages and then rename the folder into laravel-blade. Seems working with no pesky errors now. What I did is just gut feel. I did not even read anything in the files in the folder.

我所做的只是 Preference > Browse packages,然后将文件夹重命名为 laravel-blade。现在似乎没有讨厌的错误。我所做的只是直觉。我什至没有读取文件夹中文件中的任何内容。

-- Edited: Go to Preference > Browse packages > Package Control.sublime-settings and remove the offending entry.

-- 编辑:转到首选项 > 浏览包 > 包 Control.sublime-settings 并删除有问题的条目。

回答by Priyabrata

mine was stored in users folder, just do a folder search for "laravel-blade" and remove the entry from json config

我的存储在用户文件夹中,只需在文件夹中搜索“laravel-blade”并从 json 配置中删除条目

Find: laravel-blade Where: /Users/:username/Library/Application Support/Sublime Text 2/Packages

查找:laravel-blade 位置:/Users/:username/Library/Application Support/Sublime Text 2/Packages