Code Monkey home page Code Monkey logo

kirby-blade's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kirby-blade's Issues

Add support for snippet templates

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

Template views using dot notation don't work

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:

Screenshot from 2022-06-25 19-08-51

Option `doMakeSameDomainsLinksRelative` requires array, not boolean

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:

Screenshot from 2022-06-25 10-42-51

I'd suggest passing every option 'as-is', or at least check for $option == 'doMakeSameDomainsLinksRelative' ๐Ÿ˜•

Cheers,
S1SYPHOS

Removing HTML Minify

I'm thinking of removing the HTML minify feature to make it work more stable. What do users of the plugin think? ๐Ÿ‘€

Redeclared function error

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?

Custom directives only receive one argument

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'

Illuminate/Kirby redeclaring the `e()` function

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

Broken HTML minification

Hey there,
when turning on HTML minification, I get the following ParseError: syntax error, unexpected token ")"

Screenshot from 2022-06-24 12-00-55

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.

Use Laravel Blade templates in Plugin

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.

No stack trace when errors are thrown

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.