image-size-loader icon indicating copy to clipboard operation
image-size-loader copied to clipboard

Add more explanation around the "Filename placeholders"

Open fresheneesz opened this issue 9 years ago • 5 comments

Its not clear to me from the documentation how the filename placeholders might be used. Could it be elaborated on, or perhaps an example given?

fresheneesz avatar Jul 25 '15 20:07 fresheneesz

Filename placeholders are from the webpack loader docs. The source is mentioned just below that.

Example usage is given here - https://github.com/boopathi/image-size-loader#query-params

One more example - https://github.com/flipkart-incubator/phrontend-webpack/blob/master/src/webpack-config.js#L56

The line number may change, so this commit link might help in future.

boopathi avatar Jul 25 '15 22:07 boopathi

Yeah I mean, i read the readme (its short enough), and i read the docs that part linked to. I just still don't understand why you'd use it or what it does. Neither of the examples you just gave make it clear me. Maybe its one of those things that if I don't know, then i don't need it?

fresheneesz avatar Jul 26 '15 00:07 fresheneesz

I'm not sure. This example might be of some help - https://github.com/webpack/file-loader#examples.

And it's the same placeholders you'd give to the output.filename of webpack - http://webpack.github.io/docs/configuration.html#output-filename

boopathi avatar Jul 26 '15 00:07 boopathi

Oh, so if you add those parameters then it saves the file in a location on-disk, rather than creating a data: url?

fresheneesz avatar Jul 26 '15 00:07 fresheneesz

image-size-loader doesn't yet support emitting data: url. The image file is copied from the source to the target (output.path) directory and this name with placeholders is used as the new name for the file.

boopathi avatar Jul 26 '15 07:07 boopathi