I am trying to use the plugin Galleria with Webpack. Without Webpack galleria can be used as:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="galleria/galleria-1.4.min.js"></script>
<script>
(function() {
Galleria.loadTheme('https://cdnjs.cloudflare.com/ajax/libs/galleria/1.5.7/themes/classic/galleria.classic.min.js');
Galleria.run('.galleria');
}());
</script>
The theme can also be loaded manually instead of using the method loadTheme
:
<link rel=”stylesheet” type=”text/css” href=”https://cdnjs.cloudflare.com/ajax/libs/galleria/1.5.7/themes/fullscreen/galleria.classic.min.css” />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/galleria/1.5.7/galleria.min.js”></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/galleria/1.5.7/themes/classic/galleria.classic.min.js”></script>
<script>
(function() {
Galleria.run('.galleria');
}());
</script>
With WebPack I added the following code to Index.js:
import galleria from 'galleria';
import '../../node_modules/galleria/dist/themes/classic/galleria.classic.css';
import '../../node_modules/galleria/dist/themes/classic/galleria.classic.js';
window.Galleria = galleria;
(function() {
Galleria.run('.galleria');
}());
When I run it I get the errors:
No theme CSS loaded.
Init failed: Galleria could not find the element "undefined".
Any idea how to use Galleria with Webpack?