Search by

leowebguy / mix-manifest

leowebguy

A minimal plugin to load assets from mix-manifest.json

Package info

github.com/leowebguy/mix-manifest

Type:craft-plugin

pkg:composer/leowebguy/mix-manifest

Statistics

Installs: 7 961

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

2.0.0 2024-03-27 02:59 UTC

This package is auto-updated.

Last update: 2026-11-04 16:04:22 UTC


README

A minimal Craft CMS plugin to load versioned assets from mix-manifest.json (Laravel Mix / Webpack).

Requirements

This plugin requires:

  • Craft CMS: ^5.0.0
  • PHP: ^8.2 || ^8.3 || ^8.4 || ^8.5

Installation

Install the plugin via Composer:

composer require leowebguy/mix-manifest -w

Then install via the Craft Control Panel under Settings → Plugins → Mix Manifest, or via the CLI:

php craft plugin/install mix-manifest

Usage

Load a versioned asset in your Twig templates using the mix() function:

{# Look up /js/app.js in default mix-manifest.json #}
<link rel="stylesheet" href="{{ mix('/css/app.css') }}">
<script src="{{ mix('/js/app.js') }}"></script>

Output:

<link rel="stylesheet" href="/css/app.css?id=1b26b5dcee58a5ecb27d">
<script src="/js/app.js?id=e74e64fbbbc6bb05fa60"></script>

Custom Manifest Path or Alias

You can optionally specify a custom manifest filename or path (Yii path aliases like @webroot are supported):

{{ mix('/js/app.js', 'my-manifest.json') }}
{{ mix('/js/app.js', '@webroot/build/mix-manifest.json') }}

Development & Testing

# Code style check & fix (PSR-12)
composer pint
composer pint-test

# Static analysis (PHPStan Level 8)
composer phpstan

# Craft 5 Rector ruleset
composer rector

License

Proprietary / MIT - see author details.