misterbk / mix
Helper plugin for Laravel Mix in Craft CMS templates
Installs: 167 559
Dependents: 5
Suggesters: 0
Security: 0
Stars: 51
Watchers: 7
Forks: 9
Open Issues: 3
Type:craft-plugin
Requires
- craftcms/cms: ^4.0.0-alpha|^5.0.0
- dev-master
- v1.8.1
- v1.8.0
- v1.7.2
- v1.7.1
- 1.6.0
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- dev-develop
- dev-release/v1.8.1
- dev-dependabot/composer/craftcms/cms-5.7.5
- dev-dependabot/composer/symfony/http-client-6.4.19
- dev-dependabot/composer/twig/twig-3.14.2
- dev-dependabot/composer/symfony/process-7.3.0
- dev-dependabot/composer/craftcms/cms-5.5.5
This package is auto-updated.
Last update: 2025-06-18 07:37:22 UTC
README
Helper plugin for Laravel Mix in Craft CMS templates.
Requirements
This plugin requires Craft CMS 4.0.0-alpha or later, or Craft CMS 5.0.0 or later.
Installation
To install the plugin, follow these instructions.
- Open your terminal and go to your Craft project:
cd /path/to/project
- Then tell Composer to load the plugin:
composer require misterbk/mix
- In the Craft Control Panel, go to Settings → Plugins and click the "Install" button for Mix.
Configuration
To configure Mix go to Settings → Plugins → Mix in the Craft Control Panel.
The available settings are:
- Public Path - The path of the public directory containing the index.php
- Asset Path - The path of the asset directory where Laravel Mix stores the compiled files
NOTE: Both Public Path and Asset Path get trimmed to allow all kind of path combinations.
/web/
+/assets/
→/web/assets/
web
+assets
→/web/assets/
/
+assets
→/assets/
/web
+/
→/web/
Usage
Find a versioned CSS file.
<link rel="stylesheet" href="{{ mix('css/main.css') }}">
Find a versioned JavaScript file.
<script src="{{ mix('js/main.js') }}"></script>
Lazily find a versioned file and build the tag based on the file extension.
{{ craft.mix.withTag('js/main.js') | raw }}
Alternatively include the content of a versioned file inline.
{{ craft.mix.withTag('css/main.css', true) | raw }}
License
Craft Mix is open-sourced software licensed under the MIT license.