3

I'm using laravel 5.4 and I want some items to show using Isotope with layoumode packery.

I entered the commands below in my terminal without any errors:

npm install isotope-layout
npm install isotope-packery

I'm initialising isotope like this:

var Isotope = require('isotope-layout'),
    loadNewItems = false,
    postGrid;

$(window).on('load', function() {
    // postGrid = new Masonry('.grid', {
    //     itemSelector: '.grid-item',
    //     gutter: 0
    // });

    postGrid = new Isotope('.grid', {
        layoutMode: 'packery'
    });

    gridLoader(postGrid);
});

In my webpack.mix.js I have the following:

mix.webpackConfig({
    resolve: {
        alias: {
            'masonry': 'masonry-layout',
            'isotope': 'isotope-layout'
        }
    }
});

When I run my code I see the following error in my console:

Uncaught Error: No layout mode: packery

Obviously I'm doing something wrong, probably with loading Isotope or the packery layout mode.

I'm not sure if the layout mode is loaded at all since I haven't found out how to load it correctly. I thought maybe Isotope resolves that on it's own.

Any ideas what is going wrong here and how I can solve it?

  • Did you get it sorted? I have a similar issue and it seems like the libraries are loaded in the wrong order, or the packery layout not at all... would be curious to know if/how you got it working in the end... – jrgd May 18 '18 at 08:07

0 Answers0