mrfd / kirby-mix
Laravel Mix integration for Kirby 3, which hooks into the existing helper functions.
Fund package maintenance!
paypal.me/mrfdnl/5
buymeacoff.ee/mrfd
Requires
This package is auto-updated.
Last update: 2024-10-26 15:34:21 UTC
README
This plugin integrates the Laravel Mix manifest into Kirby 3, using the existing js()
and css()
helper functions.
Commerical Usage
This plugin is free but if you use it in a commercial project please consider to
Requirements
- PHP 8.0+
- Kirby 3
Installation
Download
Download and copy the files to /site/plugins/kirby-mix
.
Git submodule
$ git submodule add https://github.com/MRFD/kirby-mix.git site/plugins/kirby-mix
Composer
composer require MRFD/kirby-mix
Usage
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.
Usage example
<?= 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" />
Example webpack.mix.js
const mix = require("laravel-mix"); mix .setPublicPath("assets") .setResourceRoot("../") .sass("resources/assets/css/app.scss", "js") .js("resources/assets/js/app.js", "css") .version();
Options
Disclaimer
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.
License
Kirby WebP is open-sourced software licensed under the MIT license.
Copyright © 2020 Marijn Roovers
Credits
- Laravel Mix by Jeffrey Way