Skip to content

Fonts and Images Still Versioned when Versioning DIsabled #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pdugas opened this issue Mar 12, 2018 · 2 comments
Closed

Fonts and Images Still Versioned when Versioning DIsabled #282

pdugas opened this issue Mar 12, 2018 · 2 comments

Comments

@pdugas
Copy link

pdugas commented Mar 12, 2018

Not sure if this is by design or I'm missing something. I had enableVersioning() removed from my webpack.config.js file and the generated js and css files no longer have the hash inserted in their filenames but the files down in the images and configs subdirectories are still versioned. I need to disable versioning to share a custom icon font with a front-end app that I've not yet separated out of my project.

@Lyrkan
Copy link
Collaborator

Lyrkan commented Mar 12, 2018

Hi @pdugas,

It is indeed by design, we've made this change in #110 because not adding the hash would lead to a more annoying issue: if you had two files with the same names in different subfolders only one of them would end-up in the build folder.

The others fixes we could have implemented are explained in the PR but at the time adding a hash seemed to be the right choice (even though there is now another small thing to fix... see #246).

Since then another issue (#136) was opened by someone who felt it wasn't the right thing to do, feel free to chime in if you want to share your thoughts!

That being said, you don't have to disable versioning entirely in your case, there is a configureFilenames method that allows you to override how images/fonts are named:

webpack-encore/index.js

Lines 746 to 767 in ccbae35

/**
* Call this to change how the name of each output
* file is generated.
*
* Encore.configureFilenames({
* js: '[name].[chunkhash].js',
* css: '[name].[contenthash].css',
* images: 'images/[name].[hash:8].[ext]',
* fonts: 'fonts/[name].[hash:8].[ext]'
* });
*
* It's safe to omit a key (e.g. css): the default naming strategy
* will be used for any file types not passed.
*
* If you are using Encore.enableVersioning()
* make sure that your "js" filenames contain
* "[chunkhash]" and your "css" filenames contain
* "[contenthash]".
*
* @param {object} filenames
* @returns {Encore}
*/

@Lyrkan Lyrkan closed this as completed Mar 12, 2018
@pdugas
Copy link
Author

pdugas commented Mar 12, 2018

I had just found configureFilenames() about a minute before your response. Should work fine for me. Thanks so much for the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants