From d18ba2a711cf4f19a276df79bfa4a29b8e8d74e1 Mon Sep 17 00:00:00 2001 From: Johannes Rackles Date: Wed, 3 Jul 2019 11:19:23 +0200 Subject: [PATCH 1/4] Explain how to use fancybox together with webpack in README --- README.md | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e3c22e69..f3d2cb32 100644 --- a/README.md +++ b/README.md @@ -7,34 +7,56 @@ See the [project page](http://fancyapps.com/fancybox/3/) for documentation and a Follow [@thefancyapps](//twitter.com/thefancyapps) for updates. - ## Quick start -1\. Add latest jQuery and fancyBox files +1\. Add latest jQuery and fancyBox files ```html - + ``` - -2\. Create links +2\. Create links ```html - + - + ``` - 3\. Enjoy! +## Usage with webpack + +If you encounter a `jQuery is not defined` message when using webpack to bundle fancybox, you can add jquery as a webpack plugin. This will make sure jquery is exposed globally. + +```js +//webpack.config.js +... +plugins: [ + new webpack.ProvidePlugin({ + 'window.$': 'jquery', + 'window.jQuery': 'jquery', + 'window.jquery': 'jquery', + $: 'jquery', + jQuery: 'jquery', + jquery: 'jquery', + }) + ] +... +``` + +After you do this, you can just require fancybox without even requiring jquery: + +```js +import fancybox from '@fancyapps/fancybox'; +``` ## License @@ -56,7 +78,6 @@ Guidelines for bug reports: A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. - Feature requests are welcome. Please look for existing ones and use GitHub's "reactions" feature to vote. Please do not use the issue tracker for personal support requests - use Stack Overflow ([fancybox-3](http://stackoverflow.com/questions/tagged/fancybox-3) tag) instead. From fb74c915f01bbc4f80ce56e6153e7439231bc303 Mon Sep 17 00:00:00 2001 From: Johannes Rackles Date: Wed, 3 Jul 2019 11:22:32 +0200 Subject: [PATCH 2/4] reset indentation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3d2cb32..977babd8 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ Follow [@thefancyapps](//twitter.com/thefancyapps) for updates. ```html - + - + ``` From 43275d563d4a6e119464e17452ee427a0d33a120 Mon Sep 17 00:00:00 2001 From: Johannes Rackles Date: Wed, 3 Jul 2019 11:19:23 +0200 Subject: [PATCH 3/4] Explain how to use fancybox together with webpack in README --- README.md | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e3c22e69..f3d2cb32 100644 --- a/README.md +++ b/README.md @@ -7,34 +7,56 @@ See the [project page](http://fancyapps.com/fancybox/3/) for documentation and a Follow [@thefancyapps](//twitter.com/thefancyapps) for updates. - ## Quick start -1\. Add latest jQuery and fancyBox files +1\. Add latest jQuery and fancyBox files ```html - + ``` - -2\. Create links +2\. Create links ```html - + - + ``` - 3\. Enjoy! +## Usage with webpack + +If you encounter a `jQuery is not defined` message when using webpack to bundle fancybox, you can add jquery as a webpack plugin. This will make sure jquery is exposed globally. + +```js +//webpack.config.js +... +plugins: [ + new webpack.ProvidePlugin({ + 'window.$': 'jquery', + 'window.jQuery': 'jquery', + 'window.jquery': 'jquery', + $: 'jquery', + jQuery: 'jquery', + jquery: 'jquery', + }) + ] +... +``` + +After you do this, you can just require fancybox without even requiring jquery: + +```js +import fancybox from '@fancyapps/fancybox'; +``` ## License @@ -56,7 +78,6 @@ Guidelines for bug reports: A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. - Feature requests are welcome. Please look for existing ones and use GitHub's "reactions" feature to vote. Please do not use the issue tracker for personal support requests - use Stack Overflow ([fancybox-3](http://stackoverflow.com/questions/tagged/fancybox-3) tag) instead. From d2299d810c5a7157cd9aafdc06c529917f900b62 Mon Sep 17 00:00:00 2001 From: Johannes Rackles Date: Wed, 3 Jul 2019 11:22:32 +0200 Subject: [PATCH 4/4] reset indentation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3d2cb32..977babd8 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ Follow [@thefancyapps](//twitter.com/thefancyapps) for updates. ```html - + - + ```