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

Handle .webp images #442

Closed
gafemoyano opened this issue Aug 14, 2016 · 16 comments
Closed

Handle .webp images #442

gafemoyano opened this issue Aug 14, 2016 · 16 comments
Milestone

Comments

@gafemoyano
Copy link
Contributor

Hi

I think create-react-app can't handle .webp files right now since it throws the error message:

You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '�' (1:4)

I wouldn't like to eject just to modify webpack.config so I was wondering if the .webm extension could be added to the file-loader config.

Of course I could just convert the images to jpeg but maybe it's not such an uncommon file format and handling it could improve developer experience

@gaearon
Copy link
Contributor

gaearon commented Aug 14, 2016

Can you send a PR for this please?

@ryanyogan
Copy link

@gafemoyano Would you like assistance on a PR?

@gafemoyano
Copy link
Contributor Author

I've never done a PR before, if you could point me in the right direction on how to do it properly I'd be happy to help.

@ryanyogan
Copy link

ryanyogan commented Aug 16, 2016

Of course! I'll touch base with you tomorrow, however in the meantime, if you haven't already:

  • fork this repo into your personal Github repos.
  • Create a new branch off of master git checkout -b webp-images perhaps.
  • Start coding away, the next part is easy, I'll ping you tomorrow. Have fun hacking!

The people here are great, there is a fantastic rule once you take on the issue, it is yours, no one will attempt to "beat you to the race."

Helpful links:
Fork the repo
Add the "upstream"
Keep it in sync

@gafemoyano
Copy link
Contributor Author

Hi, thanks for the useful links!

I was wondering what would qualify as a test plan as stated on CONTRIBUTING.md for a change like this.

@gafemoyano
Copy link
Contributor Author

Is it necessary to modify this line on createJestConfig? I haven't used jest before so I'm not exactly sure of what that line does.

@ryanyogan
Copy link

@gafemoyano a "test plan" is nothing more than: "Hey! I made these changes, please test the following to make sure it looks good on your end." So you are adding webp images, perhaps put a small note in the PR on how to test that this works, maybe provide a sample image for someone reviewing to test on their local machine, etc...

@gafemoyano
Copy link
Contributor Author

So is it alright if I commit the changes I made to the project template to test that the changes were working?

@gafemoyano
Copy link
Contributor Author

Maybe not the other pull requests I checked out only commit the files that actually matter on the PR.

@ryanyogan
Copy link

Did you test locally? Give sh tasks/e2e.sh a go, I like to run Travis off
my own repo to make sure that works as well.

On Aug 16, 2016 9:25 PM, "Felipe Moyano" notifications@github.com wrote:

Maybe not the other pull requests I checked out only commit the files that
actually matter on the PR.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#442 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACifMsjdjc41tJUW8a4jLLS3acuTjtRks5qgnD6gaJpZM4Jj8B_
.

@gaearon
Copy link
Contributor

gaearon commented Aug 17, 2016

Is it necessary to modify this line on createJestConfig? I haven't used jest before so I'm not exactly sure of what that line does.

Yes, thanks. Also our Flow instructions in template/README.md.

So is it alright if I commit the changes I made to the project template to test that the changes were working?

Ideally not, just include a link to webp file in the PR so reviewers can download it and test it.

@gafemoyano
Copy link
Contributor Author

gafemoyano commented Aug 17, 2016

Thanks guys, I've gone ahead and created the pull request.

@ryanyogan As a side note I couldn't really get the e2e.sh script to work properly. I also tried running it on the master branch to make sure my changes weren't the issue but it kept giving me this error message:

+ test -e build/static/media/logo.5d5d9eef.svg
+ test -e build/favicon.ico
++ set +x
e2e.sh: \ERROR!\ An error was encountered executing line 70\.

Which is weird cause the build/favicon.ico file that gets generated includes a hash i.e. favicon.fd73a6eb.ico

but on e2e.sh the lines that tests the favicon don't seem to be accounting for it:

test -e build/static/css/*.css
test -e build/static/media/*.svg
test -e build/favicon.ico

@ryanyogan
Copy link

ryanyogan commented Aug 17, 2016

@gafemoyano Everything looks fine here: https://travis-ci.org/facebookincubator/create-react-app/jobs/152982529 here, I know recently someone added hashing to the assets however the tests (someone correct me if I am wrong) are good.

I think you should be good as long as you followed @gaearon's suggestions in the PR add a link to a sample image so someone reviewing can download a .webp image easily for testing. Make sure you updated the flow config updates (/templates/README.md) he mentioned as well. You should be golden after that.

Good work, I should note I am not on the FB team, just someone that believes in this project so I can only comment as far as my knowledge on the project goes.

Edit: It looks like you did that, congrats on your first OSS PR, you picked an awesome project to contribute to!

@gafemoyano
Copy link
Contributor Author

Thank you so much @ryanyogan for guiding me through this!! I couldn't have done it without your help and I'm glad that there's people like you on this community to guide newcomers like me.

I'm very excited to finally contribute to a project that it's growing on me and I've been finding increasingly useful every day.

So thanks again to both Ryan and Dan for being awesome and encouraging me to do this (admittedly very small) first PR.

gafemoyano added a commit to gafemoyano/create-react-app that referenced this issue Aug 23, 2016
@gaearon
Copy link
Contributor

gaearon commented Aug 25, 2016

Fixed by #458.

@gaearon gaearon closed this as completed Aug 25, 2016
@gaearon gaearon added this to the 0.2.3 milestone Aug 25, 2016
@gaearon
Copy link
Contributor

gaearon commented Aug 25, 2016

Released in 0.2.3, thanks!

stayradiated pushed a commit to stayradiated/create-react-app that referenced this issue Sep 7, 2016
feiqitian pushed a commit to feiqitian/create-react-app that referenced this issue Oct 25, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants