clubstudio / craft-asset-rev

A Craft CMS plugin to help with cache busting
MIT License
109 stars 7 forks source link

Twig filename does not change #30

Closed ThirdHyperion closed 5 months ago

ThirdHyperion commented 2 years ago

I have got asset rev up and running, the manifest json file gets update when I make changes to to files and re-mix via laravel mix.

For some reason though even though the manifest file changes, when I reload the front-end the file hash/string id stays the same.

It's currently stuck on the first time it worked, and the only other way I got it to change the string/hash to the current was by updating craft cms on a minor update.

If I delete the manifest file, and the dist folder with the app.js and app.css files in and re-mix everyrhing gets put back into place fine.

The manifest file name strings change everytime i make changes and re-build so all that seems to be working fine, it's just once refreshing the front-end / twig template the string/hash does not change to what's in the manifest file.

Am I doing something wrong or have I missed something??

<?php

use club\assetrev\utilities\strategies\ManifestFileStrategy;

return [
    '*' => [
        'strategies' => [
            'manifest' => ManifestFileStrategy::class,
            'passthrough' => function ($filename, $config) {
                return $filename;
            },
        ],
        'pipeline' => 'manifest',
        'manifestPath' => 'web/mix-manifest.json',
        'assetsBasePath' => '@webroot/dist',
    ],
];
scottwakefield commented 2 years ago

Hi @ThirdHyperion,

That is odd. I've not heard of that happening before! Let's see if we can figure it out together.

Potentially stupid question: do you have any caching (templates, static caches, etc) in place?

Can you share the contents of your mix-manifest.json file?

Just so I know I've followed your description correctly, is your project structured like this?

├── config
│   └── assetrev.php
├── web
│   ├── dist/
│   ├── index.php
│   └── mix-manifest.json
└── webpack.mix.js

Hoping we can get to the bottom of it for you (if you haven't already!)