Skip to content

Instantly share code, notes, and snippets.

@asaelx
Forked from JaminFarr/blade-mixins.pug
Last active December 21, 2015 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asaelx/558a1eb2d414583d0c14 to your computer and use it in GitHub Desktop.
Save asaelx/558a1eb2d414583d0c14 to your computer and use it in GitHub Desktop.
Laravel Blade mixins for jade for use with laravel-elixir-jade
//- 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