├── .gitignore
├── CHANGELOG.md
├── package.json
├── LICENSE.md
├── README.md
└── snippets
└── language-php.blade.cson
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | npm-debug.log
3 | node_modules
4 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.2.0
2 | * Added new `@inject` [Service Injection.](http://laravel.com/docs/5.1/blade#service-injection)
3 | * Added more aliases.
4 | * Removed `{{-- expr --}}` from the snippets.
5 | * Removed `@section {{-- exp --}} @yield`.
6 | * Removed `@lang`.
7 | * Removed `@layout`.
8 | * Updated readme.
9 |
10 | ## 0.1.0 - First Release
11 | * initial commit.
12 | * fixed some of the errors in the conversion.
13 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blade-snippets",
3 | "main": "./lib/blade-snippets",
4 | "version": "0.2.0",
5 | "description": "Laravel 5 blade snippets! useful snippets for the blade templating engine.",
6 | "activationCommands": {
7 | "atom-workspace": "blade-snippets:toggle"
8 | },
9 | "repository": "https://github.com/slayerfat/atom-blade-snippets",
10 | "license": "MIT",
11 | "engines": {
12 | "atom": ">=0.174.0 <2.0.0"
13 | },
14 | "dependencies": {}
15 | }
16 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Alejandro Granadillo
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blade templating snippets for Atom
2 |
3 | Laravel 5 blade snippets! useful snippets for the Blade Templating Engine to use in Atom.
4 |
5 | Converted from [blade-snippets for sublime](https://github.com/dev4dev/blade-snippets)
6 | using the [sublime to atom](https://github.com/james2doyle/sublime-to-atom-snippets) script.
7 |
8 | ## Usage
9 |
10 | These snippets will trigger only in `*.blade.php` files.
11 |
12 | Type any snippet and hit TAB to receive incredible results!.
13 |
14 | echo + TAB = {{ `$var` }}
15 |
16 | Checkout the [Available blade snippets.](#available-snippets)
17 |
18 | I recommend [this Blade language Package for Atom](https://atom.io/packages/language-blade) to be able to take full advantage of the Blade Templating Engine in this amazing editor.
19 |
20 | ## Available snippets
21 |
22 | | Shortcut | Result |
23 | |-----------|--------|
24 | | **!!** _or_ **uecho** _or_ **uprint** | {!! `$var` !!} |
25 | | **}}** _or_ **echo** _or_ **print** | {{ `$var` }} |
26 | | **action** | {!! link_to_action('`Controller@method`') !!} |
27 | | **asset** | {!! asset('`path`') !!} |
28 | | **auth** | @auth('`gate`')
@endauth |
29 | | **choice** | @choice('`language.line`', $`number`) |
30 | | **comment** _or_ **//** | {{-- `comment` --}} |
31 | | **each** | @each ('`item.view`', $`items`, '`item`', '`empty.view`')
32 | | **ext** _or_ **extends** | @extends('`name`') |
33 | | **fea** _or_ **foreach** | @foreach(`$array` as `$element`)
@endforeach |
34 | | **fel** _or_ **forelse**| @forelse (`$array` as `$element`)
@endforelse |
35 | | **for** | @for (`$i` = `0`; `$i` `<` `…`; `$i++`)
@endfor |
36 | | **guest** | @guest('`gate`')
@endguest |
37 | | **if** | @if (`condition`)
@endif |
38 | | **ife** | @if (`condition`)
@else
@endif |
39 | | **inc** _or_ **include** | @include('`view.name`', `['some' => 'data']`) |
40 | | **incif** _or_ **includeif** | @includeIf('`view.name`', `['some' => 'data']`) |
41 | | **when** _or_ **includewhen** | @includeWhen('`condition`', '`view.name`', `['some' => 'data']`) |
42 | | **par** _or_ **parent** | @parent |
43 | | **route** | {!! route('`name`') !!} |
44 | | **sec** _or_ **section** | @section('`name`')
@endsection |
45 | | **sshow** _or_ **secs** | @section('`name`')
@show |
46 | | **trans** | {!! trans('`language.line`') !!} |
47 | | **un** _or_ **unless** | @unless (`condition`)
@endunless |
48 | | **while** | @while (`condition`)
@endwhile |
49 | | **yl** _or_ **yield** | @yield('`section`') |
50 |
51 |
52 | ## Disclaimer
53 |
54 | Feel free to contribute!
55 |
56 | As of today, i am a complete noob at making atom packages, if there is any error,
57 | suggestion, improvement, etc, to point or make, feel free to do so.
58 |
--------------------------------------------------------------------------------
/snippets/language-php.blade.cson:
--------------------------------------------------------------------------------
1 | '.text.html.php.blade':
2 |
3 | 'blade-action-action':
4 | 'prefix': 'action'
5 | 'body': '{!! link_to_action(\'${0:Controller@method}\') !!}'
6 |
7 | 'blade-asset-asset':
8 | 'prefix': 'asset'
9 | 'body': '{!! asset(\'${0:path}\') !!}'
10 |
11 | 'blade-auth-auth':
12 | 'prefix': 'auth'
13 | 'body': '@auth (${1:gate})\n\t${2:}\n@endauth$0'
14 |
15 | 'blade-choice-choice':
16 | 'prefix': 'choice'
17 | 'body': '@choice(\'${1:language.line}\', ${2:number})'
18 |
19 | 'blade-comment-comment':
20 | 'prefix': 'comment'
21 | 'body': '{{-- ${0:comment} --}}'
22 |
23 | 'blade-comment-//':
24 | 'prefix': '//'
25 | 'body': '{{-- ${0:comment} --}}'
26 |
27 | 'blade-each-each':
28 | 'prefix': 'each'
29 | 'body': '@each (\'${1:item.view}\', ${2:\$items}, \'${3:item}\', \'${4:empty.view}\')$0'
30 |
31 | 'blade-escaped-}}':
32 | 'prefix': '}}'
33 | 'body': '{{ ${0:\$var} }}'
34 |
35 | 'blade-escaped-echo':
36 | 'prefix': 'echo'
37 | 'body': '{{ ${0:\$var} }}'
38 |
39 | 'blade-escaped-print':
40 | 'prefix': 'print'
41 | 'body': '{{ ${0:\$var} }}'
42 |
43 | 'blade-unescaped-!!':
44 | 'prefix': '!!'
45 | 'body': '{!! ${0:\$var} !!}'
46 |
47 | 'blade-unescaped-echo':
48 | 'prefix': 'uecho'
49 | 'body': '{!! ${0:\$var} !!}'
50 |
51 | 'blade-unescaped-print':
52 | 'prefix': 'uprint'
53 | 'body': '{!! ${0:\$var} !!}'
54 |
55 | 'blade-extends-ext':
56 | 'prefix': 'ext'
57 | 'body': '@extends(\'${1:view}\')$0'
58 |
59 | 'blade-extends-extends':
60 | 'prefix': 'extends'
61 | 'body': '@extends(\'${1:view}\')$0'
62 |
63 | 'blade-for-for':
64 | 'prefix': 'for'
65 | 'body': '@for (${1:\$i} = ${2:0}; ${1:\$i} ${4:<} ${3:$count}; ${5:${1:\$i}++})\n\t${6:}\n@endfor$0'
66 |
67 | 'blade-forelse-fore':
68 | 'prefix': 'fel'
69 | 'body': '@forelse (${1:\$array} as ${2:\$element})\n\t${3:}\n@empty\n\t${4:}\n@endforelse$0'
70 |
71 | 'blade-forelse-forelse':
72 | 'prefix': 'forelse'
73 | 'body': '@forelse (${1:\$array} as ${2:\$element})\n\t${3:}\n@empty\n\t${4:}\n@endforelse$0'
74 |
75 | 'blade-foreach-foreach':
76 | 'prefix': 'foreach'
77 | 'body': '@foreach (${1:\$array} as ${2:\$element})\n\t${3:}\n@endforeach$0'
78 |
79 | 'blade-foreach-forea':
80 | 'prefix': 'fea'
81 | 'body': '@foreach (${1:\$array} as ${2:\$element})\n\t${3:}\n@endforeach$0'
82 |
83 | 'blade-guest-guest':
84 | 'prefix': 'guest'
85 | 'body': '@guest (${1:gate})\n\t${2:}\n@endguest$0'
86 |
87 | 'blade-if_else-ife':
88 | 'prefix': 'ife'
89 | 'body': '@if (${1:condition})\n\t${2:}\n@else\n\t${3:}\n@endif$0'
90 |
91 | 'blade-if-if':
92 | 'prefix': 'if'
93 | 'body': '@if (${1:condition})\n\t${2:}\n@endif$0'
94 |
95 | 'blade-include-inc':
96 | 'prefix': 'inc'
97 | 'body': '@include(\'${1:view.name}\'${2:, [${3:\'some\'} => ${4:\'data\'}]})$0'
98 |
99 | 'blade-include-include':
100 | 'prefix': 'include'
101 | 'body': '@include(\'${1:view.name}\'${2:, [${3:\'some\'} => ${4:\'data\'}]})$0'
102 | 'body': '@if (${1:condition})\n\t${2:}\n@endif$0'
103 |
104 | 'blade-includeif-incif':
105 | 'prefix': 'incif'
106 | 'body': '@includeIf(\'${1:view.name}\'${2:, [${3:\'some\'} => ${4:\'data\'}]})$0'
107 |
108 | 'blade-includeif-includeif':
109 | 'prefix': 'includeif'
110 | 'body': '@includeIf(\'${1:view.name}\'${2:, [${3:\'some\'} => ${4:\'data\'}]})$0'
111 |
112 | 'blade-includewhen-when':
113 | 'prefix': 'when'
114 | 'body': '@includeWhen(${1:condition},\'${2:view.name}\'${3:, [${4:\'some\'} => ${5:\'data\'}]})$0'
115 |
116 | 'blade-includewhen-includewhen':
117 | 'prefix': 'includewhen'
118 | 'body': '@includeWhen(${1:condition},\'${2:view.name}\'${3:, [${4:\'some\'} => ${5:\'data\'}]})$0'
119 |
120 | 'blade-lang':
121 | 'prefix': 'lang'
122 | 'body': '@lang(\'${1:language.line}\'${2:, [${3:\'variable\'} => ${4:\'replacement\'}]})'
123 |
124 | 'blade-parent-par':
125 | 'prefix': 'par'
126 | 'body': '@parent'
127 |
128 | 'blade-parent-parent':
129 | 'prefix': 'parent'
130 | 'body': '@parent'
131 |
132 | 'blade-route':
133 | 'prefix': 'route'
134 | 'body': '{!! route(\'${0:name}\') !!}'
135 |
136 | 'blade-section-secs':
137 | 'prefix': 'secs'
138 | 'body': '@section(\'${1:name}\')\n\t${2:}\n@show$0'
139 |
140 | 'blade-section-sshow':
141 | 'prefix': 'sshow'
142 | 'body': '@section(\'${1:name}\')\n\t${2:}\n@show$0'
143 |
144 | 'blade-section-sec':
145 | 'prefix': 'sec'
146 | 'body': '@section(\'${1:name}\')\n\t${2:}\n@endsection$0'
147 |
148 | 'blade-section-section':
149 | 'prefix': 'section'
150 | 'body': '@section(\'${1:name}\')\n\t${2:}\n@endsection$0'
151 |
152 | 'blade-trans-trans':
153 | 'prefix': 'trans'
154 | 'body': '{!! trans(\'${0:language.line}\') !!}'
155 |
156 | 'blade-unless-unless':
157 | 'prefix': 'unless'
158 | 'body': '@unless (${1:condition})\n\t${2:}\n@endunless$0'
159 |
160 | 'blade-unless-un':
161 | 'prefix': 'un'
162 | 'body': '@unless (${1:condition})\n\t${2:}\n@endunless$0'
163 |
164 | 'blade-while-while':
165 | 'prefix': 'while'
166 | 'body': '@while (${1:condition})\n\t${2:}\n@endwhile$0'
167 |
168 | 'blade-yield-yl':
169 | 'prefix': 'yl'
170 | 'body': '@yield(\'${1:section}\')$0'
171 |
172 | 'blade-yield-yield':
173 | 'prefix': 'yield'
174 | 'body': '@yield(\'${1:section}\')$0'
175 |
176 | 'blade-inject-inject':
177 | 'prefix': 'inject'
178 | 'body': '@inject(\'${1:viewComposer}\'${2:, \'${3:YourServiceClass}\'})$0'
179 |
180 | 'blade-inject-inj':
181 | 'prefix': 'inj'
182 | 'body': '@inject(\'${1:viewComposer}\'${2:, \'${3:YourServiceClass}\'})$0'
183 |
--------------------------------------------------------------------------------