-
-
Notifications
You must be signed in to change notification settings - Fork 187
Allow function interpolation #59
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
Conversation
That looks good, thank you. Could you replace the |
Sure @jhnns, I have changed it as requested. |
index.js
Outdated
@@ -249,7 +249,12 @@ exports.getHashDigest = function getHashDigest(buffer, hashType, digestType, max | |||
}; | |||
|
|||
exports.interpolateName = function interpolateName(loaderContext, name, options) { | |||
var filename = name || "[hash].[ext]"; | |||
var filename; | |||
if (typeof name === 'function') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for nitpicking, but please use double quotes 😁 (you can push force on this branch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhnns I have used triple equations, because that was used everywhere else in the script, but I have changed as requested.
Sorry, that's a misunderstanding. Triple-equality |
I'll change that with my next commit. Anyway, thx 👍 |
@jhnns haha sorry, I totally misinterpreted :) |
Shipped with |
Currently generating names is quite restrictive - it only allows a fix number of opportunities.
I propose letting the
name
parameter to be a function, so developers can return whatever name they want based on the resource path with their own logic.As a real-life example, I would like assets in
node_modules
to be in a subfolder ofimages
named after the package, while assets from other paths should be placed in the root ofimages
. Currently I haven't found a way to achieve this.There should be no breaking change to existing configurations.