Last active
April 16, 2020 15:57
-
-
Save JaminFarr/0b875916b39bf83c4b06 to your computer and use it in GitHub Desktop.
Laravel Blade mixins for jade for use with laravel-elixir-jade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//- For use with https://github.com/CREEATION/laravel-elixir-jade | |
mixin blade() | |
='\r\n' | |
block | |
='\r\n' | |
mixin phpblock() | |
!='\r\n<?php ' | |
block | |
!='\r\n?>' | |
mixin php(php) | |
if (php) | |
!='\r\n<?php ' + php + ' ?>' | |
else | |
!='\r\n<?php ' | |
block | |
!=' ?>' | |
mixin if(op) | |
+blade @if(!{op}) | |
block | |
+blade @endif | |
//- +else and +elseif must be one indentation from +if | |
mixin elseif(op) | |
+blade @elseif(!{op}) | |
block | |
mixin else() | |
+blade @else | |
block | |
mixin unless(op) | |
+blade @unless(!{op}) | |
block | |
+blade @endunless | |
mixin for(terms) | |
+blade @for(!{terms}) | |
block | |
+blade @endfor | |
mixin foreach(terms) | |
+blade @foreach(!{terms}) | |
block | |
+blade @endforeach | |
mixin forelse(terms) | |
+blade @foreach(!{terms}) | |
block | |
mixin empty() | |
+blade @empty | |
block | |
+blade @endforelse | |
mixin while(test) | |
+blade @while(!{test}) | |
block | |
+blade @endwhile | |
mixin yield(name, defaultContent) | |
if defaultContent | |
+blade @yield('!{name}', '!{defaultContent}') | |
else | |
+blade @yield('!{name}') | |
mixin include(file, data) | |
if data | |
+blade @include('!{file}', !{data}) | |
else | |
+blade @include('!{file}') | |
mixin extends(file) | |
+blade @extends('!{file}') | |
mixin section(name, ender) | |
+blade @section('!{name}') | |
block | |
if (ender) | |
+blade @#{ender} | |
else | |
+blade @stop | |
mixin sectionshow(name) | |
+section(name, 'show') | |
block | |
mixin sectionoverwrite(name) | |
+section(name, 'overwrite') | |
block | |
mixin sectionstop(name) | |
+section(name) | |
block |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two years later and I've made the change @asaelx suggested. Sorry about that.
@FreedomKnight I'm sure you're not still waiting on an answer but here it is anyway. Just needs quotes around the blade/php values.