responsive-loader
Advanced tools
Changelog
v1.0.0
Removed support for webpack 1! Please upgrade to webpack >= 2.
The syntax to import images has changed. The query part now comes after the resource (the image) instead of the loader.
- require('responsive-loader?size=100!some-image.jpg')
+ require('responsive-loader!some-image.jpg?size=100')
That means if responsive-loader
is configured in your webpack-config, it's possible to specify image-specific options without having to add the loader part to the import path. For example:
// webpack.config.js
module.exports = {
// ...
module: {
rules: [
{
test: /\.jpg$/,
loader: 'responsive-loader',
options: {
size: 1000
//...
}
}
]
},
}
// some-file.js
const image1000 = require('some-image.jpg') // will have size 1000 from the config
const image500 = require('some-image.jpg?size=500')
ext
option was removed, in favor of format=jpg|png
. [ext]
is now part of the name
option like in other loaders (fixes #13)quality
to 85
pass
option is now called disable