Talesoft / tale-jade-laravel

A adapter to use Jade templates with the Laravel-framework
http://jade.talesoft.io
MIT License
3 stars 0 forks source link

Blade's @include vs Jade's include #5

Open imanghafoori1 opened 8 years ago

imanghafoori1 commented 8 years ago

One little missing feature of laravel blade is that we can pass additional variables as the second parameter to @include in blade (as laravel docs says) but I did not find it on tale-jade-laravel.

https://laravel.com/docs/5.3/blade#including-sub-views

@include('view.name', ['some' => 'data'])

TorbenKoehn commented 8 years ago

This is already planned in https://github.com/Talesoft/tale-jade/issues/6

Now that I see someone actually interested in it, I'll hurry up on implementing it.

Until then, notice: Jade has shared scopes. Use something like

$some= 'data'
include view-name

(with $some being available in view-name.jade) or

$viewNameData(key1='val1', key2=$val2, key3=['val4', 'val5'])
include view-name

(with $viewNameData being available in view-name.jade)

What also always works is using a mixin

mixin includeSomeView(key1, key2)
    include some-view
+includeSomeView('arg1', 'arg2')

(with $key1 and $key2 being available in some-view)

I'll update this thread when I implemented include args :)

imanghafoori1 commented 8 years ago

Very Nice. Good lock