Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

craftplugins/webpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important

This plugin is no longer maintained.

We recommend using the Twigpack plugin instead.

Webpack plugin for Craft CMS

Craft CMS plugin to help extract hashed Webpack filenames from a manifest.json file.

Webpack works on Craft 2.4.x and Craft 2.5.x.

Webpack Overview

Built to work with webpack-manifest-plugin.

This plugin expects a key/value JSON manifest file with content similar to that shown below.

{
  "mods/alpha.js": "mods/alpha.1234567890.js",
  "mods/omega.js": "mods/omega.0987654321.js"
}

Configuring Webpack

Add a webpack.php to your config directory.

/**
 * The path to the manifest.json file.
 *
 * @var string
 */
'path' => CRAFT_BASE_PATH.'../public/assets/manifest.json',

/**
 * A string to prepend to filenames.
 *
 * @var string
 */
'prefix' => '/assets/',

Using Webpack

<html>
  <head>
    <link rel="stylesheet" href="{{ craft.webpack.getFilename('main.css') }}">
  </head>
  <body>
    <script src="{{ craft.webpack.getFilename('main.js') }}"></script>
  </body>
</html>

About

📦 A plugin for Craft CMS to load hashed Webpack filenames from a manifest.json file.

Topics

Resources

License

Stars

Watchers

Forks

Languages