Skip to content
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

Sharp and webpack 2 support (aka v1 🌟) #29

Merged
merged 42 commits into from
Jul 10, 2017
Merged

Sharp and webpack 2 support (aka v1 🌟) #29

merged 42 commits into from
Jul 10, 2017

Conversation

jstcki
Copy link
Contributor

@jstcki jstcki commented Jan 7, 2017

Adds support for processing images using sharp which is much faster than Jimp or even ImageMagick.

I built on top of @langri-sha's work mentioned in #2, but instead of replacing Jimp, I added sharp as an option. Currently, you can enable it by specifying it as an adapter in the webpack config (default is still Jimp):

{
  responsiveLoader: {
    adapter: require('responsive-loader/lib/adapters/sharp')
  }
}

Auto-detection of sharp could still be added. This approach has the nice benefit that anyone can supply their own adapters once the API is stable.

I also reorganized and changed a few things, most notably:

  • added a Babel build step to ensure Node 4 compatibility (I also want to add Flow types at some point, this prepares for that)
  • replaced tape with Jest because snapshots are super-nice to test a loader's output
  • added a few more tests to make sure the adapters work in the same way

After some fiddling I got the tests to pass on Travis. sharp builds fine on the trusty environment but oddly the output of sharp seems to differ on Linux and macOS, so I had to switch to the osx environment in order to make the tests pass. I wonder if there's a better solution to this …

@novascreen
Copy link

Any chance you'll merge this soon? Anything I can do to help getting this done?
Otherwise I'll have to find a different solution. Jimp is just too slow especially with a build for server, client and storybook. Takes 1-2 minutes for every start.

@RichAyotte
Copy link

The performance improvement is dramatic with this patch. I hope you can merge it soon.

@wereHamster
Copy link

Somebody published this branch as a separate package to NPM: https://www.npmjs.com/package/responsive-loader-sharp, feel free to use that in the meantime.

@jstcki
Copy link
Contributor Author

jstcki commented Jun 19, 2017

That package's README is wrong. I will try to finish the remaining work in the next few days and release an "official" version.

@jstcki
Copy link
Contributor Author

jstcki commented Jun 26, 2017

Alright, I've just published v1.0.0-rc.1 including sharp and webpack >= 2 support.

Along the way, I dropped support for webpack 1 and had to change the import syntax a bit. Make sure to read the change log and the new README.

Please test this release and then we'll finally get it out the door πŸ˜„ . Thanks for the patience!

PS: I'll be adding the pending new features once this is done.

@jstcki jstcki changed the title [WIP] Add sharp support Sharp and webpack 2 support (aka v1 ⭐) Jun 26, 2017
@jstcki jstcki changed the title Sharp and webpack 2 support (aka v1 ⭐) Sharp and webpack 2 support (aka v1 🌟) Jun 26, 2017
@wereHamster
Copy link

I won't be able to test this because my current project still uses webpack 1, and I don't plan to upgrade to webpack 2 in this iteration.

@RichAyotte
Copy link

Works great. Thanks.

@jstcki jstcki merged commit 2bc549d into master Jul 10, 2017
@jstcki jstcki deleted the sharp branch July 10, 2017 11:43
@jstcki
Copy link
Contributor Author

jstcki commented Jul 10, 2017

Merged and released as v1.0.0 πŸŽ‰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants