bryaneschultz/vite-manifest-plugin

Twig utility function to handle Vite manifest asset files for Craft CMS.

1.0.1 2022-10-30 12:37 UTC

This package is auto-updated.

Last update: 2024-04-29 04:47:54 UTC


README

Screenshot

Requirements

This plugin requires Craft CMS 4.x or later.

Installation

1. Install with Composer

From the terminal

cd /path/to/project
composer require bryaneschultz/vite-manifest-plugin

2. Install through Craft CMS

In the Control Panel, go to SettingsPluginsVite ManifestInstall

Vite Manifest Overview

Lightweight Twig utility function to handle Vite Manifest files for Craft CMS.

Configuring Vite Manifest

Vite Manifest comes with basic configuration. To override these configuration keys, copy the contents of the config.php file to config/vite-manifest.php

[
    'webRootAlias' => '@webroot',
    'manifestFile' => 'manifest.json',
    'viteDist' => 'dist',
]

Using Vite Manifest

Basic Usage.

By default, Vite Manifest will use the version supplied by the manifest.

<link rel="stylesheet" href="{{ manifest('css/app.css') }}" />
<script src="{{ manifest('js/app.ts') }}"></script>

Advanced Usage.

If you want twig to handle the html for your asset, pass true as a second parameter.

{{ manifest('css/app.scss', true) }}
{{ manifest('js/app.ts', true) }}

License

Vite Manifest is open-sourced software licensed under the MIT license.

Vite Manifest Roadmap

Brought to you by Bryan E. Schultz