Adapted from mister-bk/craft-plugin-mix for generic Webpack support.
Adds a set of twig filters to find files in manifest.json (output by webpack-manifest-plugin) when provided with the corresponding source file.
This plugin requires Craft CMS 3.0.0 or later.
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 jdsdev/craft-manifest
- In the Craft Control Panel, go to Settings → Plugins and click the "Install" button for Manifest.
To configure Manifest go to Settings → Plugins → Manifest 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 Webpack stores the compiled files
Find a versioned CSS file.
<link rel="stylesheet" href="{{ manifest('css/main.css') }}">
Find a versioned JavaScript file.
<script src="{{ manifest('js/main.js') }}"></script>
Lazily find a versioned file and build the tag based on the file extension.
{{ manifest('js/main.js', true) | raw }}
Alternatively include the content of a versioned file inline.
{{ manifest('css/main.css', true, true) | raw }}
Craft Manifest is open-sourced software licensed under the MIT license.