clubstudio / craft-asset-rev

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

Plugin can't seem to find rev-manifest.json #4

Closed ghost closed 8 years ago

ghost commented 8 years ago

In the documentation something about assets.json is mentioned. Is this a reference to rev-manifest.json or is this a required .json file for the plugin to function?

No matter how I configure my assetrev.php, the plugin can't seem to find the hashed assets and always uses the original files.

scottwakefield commented 8 years ago

Hi @hascoulijn,

Yes, that would essentially be the same as rev-manifest.json – the filename can change based on the package you're using to create the file, or whatever your personal preference is.

Providing that you are entering the correct manifestPath in an assetrev.php config file, placed in your config directory, you shouldn't need to configure anything else.

This could be an issue as a result of a previously accepted pull request and slightly out of date docs... Can you let me know the structure of your project, e.g. where your rev-manifest.json is stored and what value you're entering as your manifestPath?

Cheers!

ghost commented 8 years ago

Hi @scottwakefield,

Thanks for the fast reply! The assets.json bit confused me a little, but I figured it had to be the manifest.json.

The rev-manifest.json is stored directly in Craft's public directory as well as my css and js directories with therein the hashed an original files. The rev-manifest.json states "css/main.css": css/main-8018e8c229.css.

The documentation states that a relative path should suffice for the manifestPath, only this was not the case for me. After filling out an absolute path to my rev-manifest.json I encountered an error stating that manifest.json couldn't find a main.css file which I then fixed by adding {base: 'public'}, which seemed to be causing a problem, to my rev task in gulpfile.js.

Cheers!

scottwakefield commented 8 years ago

Hi @hascoulijn,

No worries!

manifestPath should be relative to your CRAFT_BASE_PATH (providing the path entered doesn't start with /, otherwise it's treated as absolute). So, providing your directory structure is the same as the defaults, you should have been able to use ../public/rev-manifest.json.

Seems like you've got it working now, but does that work for you too?

I'll take a look at the code/docs and update it to help avoid any confusion! 👍