{"action":"created","issue":{"url":"https://api.github.com/repos/aFarkas/lazysizes/issues/267","repository_url":"https://api.github.com/repos/aFarkas/lazysizes","labels_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/267/labels{/name}","comments_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/267/comments","events_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/267/events","html_url":"https://github.com/aFarkas/lazysizes/issues/267","id":154183463,"number":267,"title":"What is the correct require() pattern for the plugins ?","user":{"login":"lunelson","id":1242864,"avatar_url":"https://avatars.githubusercontent.com/u/1242864?v=3","gravatar_id":"","url":"https://api.github.com/users/lunelson","html_url":"https://github.com/lunelson","followers_url":"https://api.github.com/users/lunelson/followers","following_url":"https://api.github.com/users/lunelson/following{/other_user}","gists_url":"https://api.github.com/users/lunelson/gists{/gist_id}","starred_url":"https://api.github.com/users/lunelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunelson/subscriptions","organizations_url":"https://api.github.com/users/lunelson/orgs","repos_url":"https://api.github.com/users/lunelson/repos","events_url":"https://api.github.com/users/lunelson/events{/privacy}","received_events_url":"https://api.github.com/users/lunelson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-11T08:05:53Z","updated_at":"2016-05-17T09:54:16Z","closed_at":null,"body":"I notice there's a `-umd` version of the script; however I can't find any reference to the **exact pattern for bundling that script with plugins**, using `require()`.\r\n\r\nThe following typical `<script>` order also works as an order for concatenation;\r\n\r\n```html\r\n<script src=\"../plugins/parent-fit/ls.parent-fit.min.js\"></script>\r\n<script src=\"../plugins/object-fit/ls.object-fit.min.js\"></script>\r\n<script src=\"../plugins/respimg/ls.respimg.min.js\"></script>\r\n<script src=\"../lazysizes.min.js\" async=\"\"></script>\r\n```\r\n\r\nbut what is it right for `require()`? Do I need to make a global assignment, and if so, how to bring in the plugins correctly?\r\n\r\n```js\r\n// e.g. browserify\r\nglobal.lazysizes = require(\"../lazysizes-umd.min.js\");\r\nrequire(\"../plugins/parent-fit/ls.parent-fit.min.js\");\r\nrequire(\"../plugins/object-fit/ls.object-fit.min.js\");\r\nrequire(\"../plugins/respimg/ls.respimg.min.js\");\r\n```"},"comment":{"url":"https://api.github.com/repos/aFarkas/lazysizes/issues/comments/219671815","html_url":"https://github.com/aFarkas/lazysizes/issues/267#issuecomment-219671815","issue_url":"https://api.github.com/repos/aFarkas/lazysizes/issues/267","id":219671815,"user":{"login":"lunelson","id":1242864,"avatar_url":"https://avatars.githubusercontent.com/u/1242864?v=3","gravatar_id":"","url":"https://api.github.com/users/lunelson","html_url":"https://github.com/lunelson","followers_url":"https://api.github.com/users/lunelson/followers","following_url":"https://api.github.com/users/lunelson/following{/other_user}","gists_url":"https://api.github.com/users/lunelson/gists{/gist_id}","starred_url":"https://api.github.com/users/lunelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunelson/subscriptions","organizations_url":"https://api.github.com/users/lunelson/orgs","repos_url":"https://api.github.com/users/lunelson/repos","events_url":"https://api.github.com/users/lunelson/events{/privacy}","received_events_url":"https://api.github.com/users/lunelson/received_events","type":"User","site_admin":false},"created_at":"2016-05-17T09:54:16Z","updated_at":"2016-05-17T09:54:16Z","body":"So you mean, the pattern I listed above, without the global assignment, is correct? i.e. that the `lazySizes` global variable is created automatically, and the plugins are added correctly, if I do as follows? If so, I will make a PR on the documentation to indicate this.\r\n```js\r\n// e.g. browserify\r\nrequire(\"../lazysizes-umd.min.js\");\r\nrequire(\"../plugins/parent-fit/ls.parent-fit.min.js\");\r\nrequire(\"../plugins/object-fit/ls.object-fit.min.js\");\r\nrequire(\"../plugins/respimg/ls.respimg.min.js\");\r\n```"}}