Migrating from jade to blade
Clone this wiki locally
Debugging / Errors
Most blade errors will indicate where the error occurred with
>. Look for the
Occasionally (once you have fixed all the well-described errors) Blade will give a completely uninformative error (something akin to "I failed"). This does not help us to debug. The easiest solution I found was to delete most of the template, then add bits back in until it broke again, hence isolating the issue.
(If Blade gave more useful error messages, we might have switched to it. But it was one of the major reasons we ended up sticking with Jade! Anyway I digress.)
Here's what you need to know when converting your Jade templates into Blade templates... (brought to you by joeytwiddle at Sunride!)
Indentation is stricter in blade. Don't indent unless you really have to! And only indent one level.
- for x in list
foreach list as x
and then an extend block
block thisBlock ...
replace thisBlock ...
The original template can remain the same
mixin myMixin(a,b,c) ...
function myMixin(a,b,c) ...
but both of those require installing extra libraries.
A simpler way I found was just to write some unescaped HTML:
! <style> ... </style>
There may be a better way, but I haven't found it yet.