This plugin integrates the Laravel Mix manifest into Kirby, using the existing js()
and css()
helper functions.
This plugin is free but if you use it in a commercial project please consider to
- PHP 8.0+
- Kirby 3+
Download and copy the files to /site/plugins/kirby-mix
.
$ git submodule add https://github.com/MRFD/kirby-mix.git site/plugins/kirby-mix
composer require MRFD/kirby-mix
This plugin helps with the long-term caching that Laravel Mix provides with the mix.version()
function. Read more about it in the Laravel Mix documentation.
The plugin is enabled by default, and passes files trough that are not in the manifest. All functionality offered by the js()
and css()
helpers remains unchanged.
<?= css('assets/js/app.css') ?>
<?= js('assets/js/app.js') ?>
<script src="https://domain.com/assets/js/app.js?id=c14116f0ac177cab618e"></script>
<link
href="https://domain.com/assets/css/app.css?id=ffd6ebc479deb7f64dec"
rel="stylesheet"
/>
const mix = require("laravel-mix");
mix
.setPublicPath("assets")
.setResourceRoot("../")
.sass("resources/assets/css/app.scss", "js")
.js("resources/assets/js/app.js", "css")
.version();
Option | Default | Description |
---|---|---|
mrfd.mix.enable |
true |
Activated or deactivated the Kirby Mix plugin. |
mrfd.mix.manifest |
mix-manifest.json |
File name including extension of the manifest file. |
mrfd.mix.publicPath |
assets |
The public path to the assets folder. |
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
Kirby Mix is open-sourced software licensed under the MIT license.
Copyright © 2020 Marijn Roovers
- Laravel Mix by Jeffrey Way