cognetif/kirby-blade-mix

This package is abandoned and no longer maintained. No replacement package was suggested.

Mix Directive for Kirby Blade Templating

v0.1.0 2020-07-31 13:41 UTC

This package is auto-updated.

Last update: 2024-02-26 14:51:06 UTC


README

This project adds a @mixcss and @mixjs directive available for use in Blade templating when using the afbora/kirby-blade templating plugin.

Installation

To install, simply require with composer:

$ composer require cognetif/kirby-blade-mix

Add the following to your Kirby config file:


    'afbora.blade.directives' => [
        'mixjs' => function ($file)
        {
            return "<?= \Cognetif\Kirby\Mix\Mix::Js({$file}) ?>";
        },
        'mixcss' => function ($file) {
            return "<?= \Cognetif\Kirby\Mix\Mix::Css({$file}) ?>";
        }
    ]

Then you can use the directive in your blade templates such as:


<head>
    @mixcss('/assets/main.css');
</head>
<!-- ... -->
<body>
    @mixjs('/assets/main.js');
</body>

Mix Manifest Json

The directive assumes your mix-manifest.json is in the $kirby->root('index') path, otherwise known as your public folder with the main site index.php file.