Best laravel framework open-source packages.

Oc mix manifest plugin

Read Laravel Mix Manifest in OctoberCMS
Updated 4 months ago

Read Mix Manifest with Twig Function

This little plugin reads the Mix Manifest that is generated by the standalone version of Laravel Mix.

Setup

In order to use this plugin you will need set up Laravel Mix (duh!) and enable the versioning in the webpack.mix.js.

This plugin depends on several config fields, which should be set correctly. Most of the properties should already be correct when left default, but you should definetely set your app url correctly. You can find this property in the config/app.php file.

The next step is set up your env file and add the MANIFEST_PATH field to your env file. This entry needs to points directly to the manifest file in your project.

How to use

After installing this plugin you can call mix() in Twig. This function takes one parameter which should be the relative path to the file from inside your assets folder.

<link rel="stylesheet" href="{{ mix('/dist/app.css') }}">

Advanced usage

Without a second parameter the mix function assumes that your relative path starts at themes/{themename}/assets. If your assets are located elsewhere you can pass a second parameter to the function which replaces the standard "/assets" path prefix.

Note: The / before the actual path is required for this to work

<link rel="stylesheet" href="{{ mix('/dist/app.css' , '/my-assets-path') }}">

Deprecation notice

In previous versions the mix function was called getVersionedCss. To prevent breaking changes this still works, but the new mix method is favored of the old getVersionedCss.

Setting up Laravel Mix

This plugin is based on a front-end workflow based on Jeffrey Way's standalone Laravel Mix that can be found here. An example of a package.json and webpack.mix.js are also present in this repository. Further documentation on how to use Laravel Mix can be found in the docs of Laravel Mix.

License

While there isn't much to license, we'd appreciate it if you do not sell the plugin or the code in it as your own, either under a new name or as part of your own plugin.