Getting size data without emitting files
Is it possible use this loader without outputting files?
Why ?
I'm not clear about your use-case. You can simply ignore the file that's outputted if that's an option.
https://github.com/boopathi/image-size-loader/blob/4fa307fd391f0d262f6dfe1c14d88b458081b71b/index.js#L46
This is the code that's responsible for the copying the image. PR welcome :).
Well, I'm new to the custom loader thing, so maybe I'm doing something unusual/wrong. Basically I'm getting the dimensions of images that are sprites in a game. I just check the images so I know how to scale the plane that I'm applying them to.
In my case I'm still just requesting them via ajax from their original folder. Would it to be more normal to read from /src and move them to an out folder from which they can be required?
I need this feature too. The reason is: I'm using url-loader to get data-uri images. So I do not need to emit files, because they are inlined.
P.S. @boopathi Probably it would be cool if this loader will work on top of url-laoder/file-loader to reuse the abilities of that loaders.
There is one more thing. What are you thinking about this hack?
var foo = new String('foo/bar.gif');
Object.assign(foo, {
width: 123
});
console.log(foo + '', foo.width)
@SleepWalker, @rhys-vdw
If you still need this, I've forked this loader to one which doesn't output the file: https://github.com/tremby/image-dimensions-loader (also published on NPM as image-dimensions-loader).
@boopathi: assuming you're not going to add an option to do something similar, a link from your readme to my fork for others looking for this feature would be appreciated.