-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
532 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# Change Log | ||
|
||
## v1.1.0 | ||
|
||
- Added `min` and `max` options to automatically generate a number of images, and `steps` option to say how many images ([#31](https://github.com/herrstucki/responsive-loader/pull/31)). | ||
|
||
## v1.0.0 | ||
|
||
### New | ||
|
||
- 🚀 Added support for [sharp](https://github.com/lovell/sharp) ([#19](https://github.com/herrstucki/responsive-loader/pull/29)) | ||
|
||
### Breaking | ||
|
||
#### Webpack 2 support | ||
|
||
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. | ||
|
||
```diff | ||
- 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: | ||
|
||
```js | ||
// 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') | ||
``` | ||
|
||
#### Other breaking changes | ||
|
||
- The `ext` option was removed, in favor of `format=jpg|png`. `[ext]` is now part of the `name` option like in other loaders (fixes [#13](https://github.com/herrstucki/responsive-loader/issues/13)) | ||
- Changed default JPEG `quality` to `85` | ||
- The `pass` option is now called `disable` | ||
|
||
## v0.7.0 | ||
|
||
- Add `placeholder` option ([#16](https://github.com/herrstucki/responsive-loader/pull/16)) | ||
- Add `width` and `height` attributes to output ([#19](https://github.com/herrstucki/responsive-loader/pull/19)) | ||
|
||
## v0.6.1 | ||
|
||
- Declare default `name`, `context`, `quality`, and `background` through webpack options when they're not specified in the loader query ([#12](https://github.com/herrstucki/responsive-loader/pull/12)). | ||
|
||
## v0.6.0 | ||
|
||
- Add linting ([#7](https://github.com/herrstucki/responsive-loader/pull/7)) | ||
- Breaking (maybe): Require node >= v4 | ||
|
||
## v0.5.3 | ||
|
||
- Fix wrong callback being called on file load error ([#6](https://github.com/herrstucki/responsive-loader/pull/6)) | ||
|
||
## v0.5.2 | ||
|
||
- Added tests! | ||
- Update `queue-async` to `d3-queue` | ||
|
||
## v0.5.1 | ||
|
||
- Optimization: skip resizing images of the same size ([#5](https://github.com/herrstucki/responsive-loader/pull/5)) | ||
|
||
## v0.5.0 | ||
|
||
Using the `size` option for getting only one resized image no longer just returns a string but the same object structure as when using `sizes`. The difference is, that when `toString()` is called on that object, it will return the path of the first resized image. | ||
|
||
Also, for pure convenience, the returned object also contains a `src` property, so it can be spread onto a React component (e.g. `<img {...resized} />`). | ||
|
||
### Before | ||
|
||
This worked: | ||
|
||
```js | ||
import resized from 'responsive?sizes[]=100,sizes[]=200'; | ||
|
||
<img srcSet={resized.srcSet} src={resized.images[0].path} /> | ||
``` | ||
|
||
```css | ||
.foo { background-image: url('responsive?size=100'); } | ||
``` | ||
|
||
But this didn't :sob:: | ||
|
||
```js | ||
import resized from 'responsive?size=100'; | ||
|
||
// Whoops, error because `resized` ist just a string | ||
<img srcSet={resized.srcSet} src={resized.images[0].path} /> | ||
``` | ||
|
||
```css | ||
/* Whoops, `url('[object Object]')` */ | ||
.foo { background-image: url('responsive?sizes[]=100'); } | ||
``` | ||
|
||
### After | ||
|
||
All these work :v: | ||
|
||
```js | ||
import resized from 'responsive?sizes[]=100,sizes[]=200'; | ||
|
||
<img srcSet={resized.srcSet} src={resized.src} /> | ||
<img srcSet={resized.srcSet} src={resized} /> | ||
<img {...resized} /> | ||
``` | ||
|
||
```css | ||
.foo { background-image: url('responsive?sizes[]=100,sizes[]=200'); } | ||
.foo { background-image: url('responsive?sizes[]=100'); } | ||
.foo { background-image: url('responsive?size=100'); } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2016, Jeremy Stucki | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of responsive-loader nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
Oops, something went wrong.