ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Extract Text to Laravel Blade View

by MohannadNaj ST3

Extract selected text to laravel blade view

Details

Installs

  • Total 1K
  • Win 1K
  • OS X 144
  • Linux 212
May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5
Windows 7 6 12 8 10 10 5 5 16 11 11 11 18 9 8 9 10 12 14 6 3 2 8 12 9 9 19 13 8 8 5 10 14 17 19 8 8 10 6 9 8 17 7 9 9 9
OS X 1 2 4 2 0 1 1 0 0 1 1 4 3 1 0 2 0 1 2 2 1 0 0 2 0 1 0 2 1 0 0 2 4 2 1 3 0 1 1 1 1 0 0 0 0 0
Linux 0 0 3 5 0 3 3 2 1 1 3 3 3 2 3 4 3 2 4 3 3 2 1 6 3 2 3 0 3 2 0 3 1 2 1 2 2 1 2 3 2 1 4 0 2 1

Readme

Source
raw.​githubusercontent.​com

Extract Text to Laravel Blade View

Build Status Build status

This plugin for Sublime Text 3 allows you to extract the selected text into a new or existing laravel blade views with the @include sentence and the appropriate path.

screenshot

💾 Installation

Package Control

It is highly recommended to install Extract Text to Laravel Blade View with Package Control.

  1. Install Package Control if you haven't yet.
  2. Open the command palette (Ctrl+Shift+P for Windows/Linux, Cmd+Shift+P for Mac OS)
  3. Search for Package Control: Install Package and hit Enter.
  4. Type Extract Text to Laravel Blade View and press Enter to install it.

Manual Installation

You can clone this repository into your Sublime Text 3/Packages

git clone https://github.com/MohannadNaj/sublime-extract-to-blade
Mac OS
cd ~/Library/Application Support/Sublime Text 3/Packages/
git clone git://github.com/MohannadNaj/sublime-extract-to-blade.git
Linux
cd ~/.config/sublime-text-3/Packages
git clone git://github.com/MohannadNaj/sublime-extract-to-blade.git
Windows
cd "%APPDATA%\Sublime Text 3\Packages"
git clone git://github.com/MohannadNaj/sublime-extract-to-blade.git

👉 The git command must be available on the command line.

👉 You may need to add the directory containing git.exe to your PATH environment variable.

Usage

  • While on a Laravel Blade View, Select some text
  • open the Command Palette (Ctrl+Shift+P for Windows/Linux, Cmd+Shift+P for Mac OS), and look for “Extract: Move selection to blade view ..”.

    Alternatively, you can set a key map for this step. see Keymap

  • Enter the blade path for the new blade view (e.g: welcome.services)

    you can use relative blade paths also if it's enabled. see Options

The plugin will create or append the extracted text to the newly created blade view, and insert @include statement in the text source file. The plugin will look for the resources/views/ directory to resolve the entered path.

Options

Set your options by navigating to Preferences > Settings.

extract_to_blade_save_last_path

default: true “ js { "extract_to_blade_save_last_path”: true }

By enabling this option, the plugin will remember how you located the directory of the blade file the last time you extracted text, and will set the next input to the same directory.

If you extracted a portion of the text to `welcome.about`, the next time the input will be ready for you by default: `welcome.`.

### extract_to_blade_relative_path
_default: false_
``` js
{
    "extract_to_blade_relative_path": false
}

By enabling this option, the plugin will build the blade paths relatively to the text source file path.

If you extracted text from resources/views/layouts/app.blade.php and typed: header, it will create the file on resources/views/layouts/, so the blade path for it will be: @include('layouts.header').

Disable this if you used to write the full blade path at your include statements.

extract_to_blade_include_sentence

default: @include('%s') “ js { "extract_to_blade_include_sentence”: “@include('%s')” }

The sentence will be used for entering the resolved blade path.

Change this if you prefer the double quotes over the apostrophe for example.
``` js
{
    // double quotes + 4 lines after!!
    "extract_to_blade_include_sentence": "@include(\"%s\")\n\n\n\n"    
}

Keymap

You can set the keymap for extracting the selected text to a Laravel blade view from Preferences > Key Bindings. Assuming you want Ctrl+Alt+E as the command shortcut: “ js [ // windows { "keys”: [“ctrl+alt+e”], “command”: “extract_to_blade”},

// Linux and Mac OS
{ "keys": ["super+alt+e"], "command": "extract_to_blade"},

]

## Credits

- The forked [Extract Text to File](https://github.com/dreki/sublime-extract-to-file) plugin
- The [Installation](#installation) part on this README was modified from [GitGutter's README file](https://github.com/jisaacks/GitGutter/blob/master/README.md)