kaapiii/concrete5-laravel-mix

Add versioned Laravel Mix files (based on your mix-manifest.js) to concrete5 themes and packages

0.2 2020-07-20 15:27 UTC

This package is auto-updated.

Last update: 2024-05-22 14:46:14 UTC


README

Actions Status Latest Stable Version Total Downloads License

Provides wrapper methods for loading easily versioned laravel mix assets in concrete5 packages (and themes).

Installation

  1. Require library with composer
    composer require kaapiii/concrete5-laravel-mix

How does it work

Let's assume your mix-manifest.json contains following assets:

{
    "/dist/css/main.css": "/dist/css/main.css?id=fd593dbed17d9fd9391f",
    "/dist/js/main.js": "/dist/js/main.js?id=c833b937dc546bf8c034"
}

By adding the following snippet to your head.php or footer.php or any php file...

<?php $mix->printAsset('/dist/css/main.css') ?>
<?php $mix->printAsset('/dist/js/main.js') ?>

we get the following output (with cache busting).

<link type="text/css" rel="stylesheet" href="/dist/css/main.css?id=fd593dbed17d9fd9391f" />
<script src="/dist/js/main.js?id=c833b937dc546bf8c034"></script>

Testing

Unit tests can be run by executing github workflows/actions locally with nektos/act and this command.

act -P ubuntu-latest=shivammathur/node:latest

Or with ...

composer run-script test