clubstudio / craft-asset-rev

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

None of the configured strategies `manifest` returned a value. #22

Closed jamesmacwhite closed 5 years ago

jamesmacwhite commented 5 years ago

I'm coming from a Craft 2 project which originally used the Gulp Rev plugin. I'm using this plugin as a replacement as it does everything that Gulp Rev did and more! I'm having issues with the manifest pipeline method however.

None of the configured strategies `manifest` returned a value.

This suggest the rev-manifest.json is not being found. This is the directory structure I have:

- assets (Contains several directory for assets that get rev'ed by the build process
- config
...
- web (Craft 3's web folder)
  - dist
     - rev-manifest.json

Contents in the assets folder are created as rev assets in the web/dist folder. A rev-manifest.json is output to the web/dist folder, however no matter I configure in the assetrev.php I get the above error on the manifest strategy locally (for testing). Passthrough works fine for dev.

<?php
return [
    '*' => [
        'strategies' => [
            'manifest' => \club\assetrev\utilities\strategies\ManifestFileStrategy::class,
            'querystring' => \club\assetrev\utilities\strategies\QueryStringStrategy::class,
            'passthrough' => function ($filename, $config) {
                return $filename;
            },
        ],
        'pipeline' => 'manifest',
        'manifestPath' => 'web/dist/rev-manifest.json',
        'assetUrlPrefix' => '@staticAssetBaseUrl/',
    ],
    'dev' => [
        //'pipeline' => 'passthrough',
        //'manifestPath' => null,
    ]
];

Any ideas?

jamesmacwhite commented 5 years ago

Ah , so this looks like a legacy thing from Gulp Rev.

Previously paths for being revved were 'dist/folder/file.jpg'. However under this plugin, including the dist part in the rev twig function is wrong, it should instead be added to the assetUrlPrefix.

Changing the paths for the files themselves fixes this error, so it's not an issue accessing the rev-manifest.json.

HelgeSverre commented 4 years ago

To future searchers: This error most likely occurred because you forgot to compile your assets so the manifest file this plugin reads is empty, thereof the error.