francoischalifour / medium-zoom

🔎🖼 A JavaScript library for zooming images like Medium
https://medium-zoom.francoischalifour.com
MIT License
3.65k stars 165 forks source link

Deploys on pull requests #16

Closed francoischalifour closed 7 years ago

francoischalifour commented 7 years ago

This PR sets the environment to enable previews on deploy when we send pull requests.

Why

medium-zoom is now hosted on Netlify. It would be nice to create previews for each pull request. It would avoid to pull the code locally and check that the new code works.

Problem

However, Netlify currently serves /examples/javascript as index. The javascript folder contains the default index.html which is the demo, development/index.html for development purpose and preview/index.html to preview a pull request (hopefully).

Since the /examples/javascript folder is not the root, we can't access /dist which contains all the built library. We therefore need to copy these files to /examples/javascript/preview before previewing the changes. Thus, the new script npm run preview.

Solution

In the javascript example:

To run on Netlify:


Hopefully this will work and trigger a preview for each PR at [name].netlify.com/preview.