afbora / kirby-blade Goto Github PK
View Code? Open in Web Editor NEWEnable Laravel Blade Template Engine for Kirby 3
License: MIT License
Enable Laravel Blade Template Engine for Kirby 3
License: MIT License
New Test #5 by Ahmet Bora
The errors that blade throws are often useless because there is no real stack trace. Although there is no real stack trace it will produce a hint as to which view had the error in the top level error but only if you use a laravel directive to include it. If you use a kirby snippet() helper you will only see an error with no stack trace and a reference to the blade template that called it.
We have developed a custom blocks plugin, it would be very handy if we could also store the default blade templates inside the plugin. Thank you.
I've tried defining a custom directive in the config file, however the closure only ever receives one argument.
'afbora.blade.directives' => [
'test' => function ($foo, $bar) {
return "bar:($bar) foo:($foo)";
}
],
Usage:
@test('baz', 'quaz')
This results in the error:
ArgumentCountError thrown with message "Too few arguments to function Kirby\Filesystem\F::{closure}(), 1 passed and exactly 2 expected"
If I make the second argument optional function ($foo, $bar = null)
then I get this output:
bar:() foo:('baz', 'quaz')
You see the second $bar properly is empty and $foo contains the string 'baz', 'quaz'
Is it possible to register/use components? Like here https://laravel.com/docs/7.x/blade#components ?
Hey there,
when turning on HTML minification, I get the following ParseError
: syntax error, unexpected token ")"
When disabling HTML minification, everything works fine and behaves as expected (great plugin, thanks <3).
Now, even when just using <html></html>
and nothing else. I know that it originates somewhere in symfony/css-selector
and I can't figure out which )
and where it comes from - but it's certainly not from within my HTML being passed to kirby-blade
.
It's almost impossible to debug when it fails
Hey there,
when looking at voku/htmlmin
options, it's clear that doMakeSameDomainsLinksRelative
is the only option receiving an array (not a boolean like the others). Therefore, it's logical that passing true
/ false
inside config.php
throws a TypeError
:
I'd suggest passing every option 'as-is', or at least check for $option == 'doMakeSameDomainsLinksRelative'
๐
Cheers,
S1SYPHOS
Hey there,
I'm used to name templates & stuff in dot notation, eg there's blog.article
, blog.audio
& blog.video
for different formats of blog entries. Their templates would would be named blog.article.php
etc, their content files blog.article.en.txt
etc BUT when using your plugin, naming the template (= view) something like blog.article.blade.php
doesn't work, because ..
.. line 86 in src/Template.php
throws an InvalidArgumentException
:
# src/Template.php
# line 86 be like:
$html = $this->blade->make($this->name, $data)->render(); # boom!
Here's an example from a page where the template name contact.press
cannot be found:
Just installed this plugin, I can't even load a page (any page), because there is a conflict with the e()
function between Kirby and Illuminate.
PHP Fatal error: Cannot redeclare e() (previously declared in /---/vendor/illuminate/support/helpers.php:607) in /---/kirby/config/helpers.php on line 162
I have absolutely no idea how to deal with this.
Thank you
New Feature #4 by Ahmet Bora
I have Kirby and kirby-blade both installed via composer:
"require": {
"php": ">=7.1.0",
"afbora/kirby-blade": "^1.7",
"getkirby/cms": "^3.0"
},
I've got a markdown file with a title
, and the default blad template is outputting <h1>@page('title')</h1>
When I run my dev server I get the following error:
Fatal error: Cannot redeclare e() (previously declared in /Users/[username]/Work/[repo]/vendor/illuminate/support/helpers.php:252) in /Users/[username]/Work/[repo]/kirby/config/helpers.php on line 160
Any ideas how this is happening and how I might get around it?
I'm thinking of removing the HTML minify feature to make it work more stable. What do users of the plugin think? ๐
Currently only blade templates that are present in the configured template directory (/templates
by default) are compiled. Is it possible to support compiling templates from the snippets directory too?
All of the snippets are basically really short templates, they're just organized elsewhere. Right now, my template templates are in beautiful blade syntax and my snippet templates are still wrapper in hard to read php tags
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.