I may be missing something but the location of the minified js and css files look like that have changes with the release of mmenu 6.0.0 from. Patch attached to update hook_libraries_info()

from:

/dist/js/jquery.mmenu.all.min.js
/dist/js/jquery.mmenu.all.min.css

to:

/dist/jquery.mmenu.all.min.js
/dist/jquery.mmenu.all.min.css
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bigjim created an issue. See original summary.

tanc’s picture

Thanks for the report, I'll look into it. We'll probably need to support both paths for backwards compatibility, or require everyone updates to version 6 of the mmenu library.

bigjim’s picture

No problem, here's the mmenu commit that makes the change

https://github.com/FrDH/jQuery.mmenu/commit/28cdf6d0724f6ce983423185de22...

tanc’s picture

Title: JS and CSS min files moved in mmenu » JS and CSS files moved in mmenu version 6.x
bigjim’s picture

I think something like this would do it, I'm not sure if the versions element in hook_libraries_info() will cover all previous versions?

So does it need one element in the version array for every minor release or will declaring 5.7 cover 5.7.x and before? Or do you need individual declarations for each minor release5.7.8, 5.7.7, 5.7.6 etc...

bigjim’s picture

Status: Active » Needs review
FileSize
1.25 KB

Okay found a comment in the API docs that clarifies the versioning issue I raised in #5 above.

As an added bonus, versions pervious to 5.6 have a different file name for the minified js (jquery.mmenu.min.all.js). Also, versions 5.4 & 5.5 move the files into js and css sub-folders of the /dist/core folder. Those same files are in /dist for version 5.0 - 5.3, I didn't put anything in here to support 4.x releases of mmenu.

Patch added here.

tanc’s picture

Great! Thanks for the patch, I'll try and review asap

Grimreaper’s picture

Hello,

Same problem on the Drupal 8 version.

I wanted to test the module and so I downloaded the last version of mmenu, 6.1.0.

Here is a patch for the Drupal 8 version.

dhumed’s picture

^ Does the responsive menu work with the patch? I'm wanting to implement this menu on a personal site.

tanc’s picture

Can you please test it and report back?

dhumed’s picture

I've tested the patch from Grimreaper and can confirm that the module now works for Drupal 8. Exact steps that I followed:

  • Used the command line to navigate to the responsive_menu folder
  • Ran the following command to apply the patch curl https://www.drupal.org/files/issues/responsive_menu-mmenu_evolution-2867087-8.patch | patch -p1
  • Went to the /libraries/mmenu directory and created a directory titled dist
  • Placed the jquery.mmenu.all.css and jquery.mmenu.all.js files inside the newly created dist directory
  • Went to the Drupal site and placed the Responsive menu mobile icon block
tanc’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
Assigned: Unassigned » tanc
Status: Needs review » Reviewed & tested by the community

Excellent! Thank you for testing. I'm going to mark this as RTBC and switch to 8.x for now. Then we can switch back to 7.x and test that other patch.

My only concern with committing this patch is that it will break backwards compatibility with currently installed versions of mmenu which are prior to 6.x.x. I'm not sure how to tackle that at the moment. Any ideas?

Grimreaper’s picture

Hello,

For backwards compatibility, here is a suggestion.

Maybe declaring two Drupal libraries, one for < 6.0.0 and one for > 6.0.0.

Adding a check if a certain file is installed or parsing one of the .json files at the root of the library as its have the library version, and then adding the appropriate Drupal library.

tanc’s picture

That was about my line of thinking too. I guess we'd have config that would be set once the settings page was saved that would set the library version (via a file check as you mentioned). The setting could be hidden from the form so it would be transparent to the user. This way there is single file check when viewing/saving the form avoiding doing it every page load.

dpacassi’s picture

I can confirm that #8 works great with mmenu 6.1.0

tanc’s picture

Status: Reviewed & tested by the community » Needs work

As an added complication, the 6.x version that is downloaded from the mmenu site has a different file layout. This is the layout that you get if you run the new task runner to compile just the files you need. So its getting a bit complicated and we'll either have to direct people to download a github release and detect the file layout for 5.x and 6.x versions, or we try to cover all permutations including compiled versions. Needs more thought.

milopca’s picture

#8 also works fine for me. Thanks!

anrikun’s picture

Same patch as #8 for D7

  • tanc committed e48ab46 on 8.x-2.x
    Issue #2867087 by Grimreaper, tanc: JS and CSS files moved in mmenu...
anrikun’s picture

Issue tags: +Needs backport to D7
grshane’s picture

The latest version of mmenu gets downloaded into libraries/jquery.mmenu not libraries/mmenu. #8 now no longer works. Hammer.js has a similar issue it is downloaded into libraries/hammer.js not libraries/hammerjs.

If it makes any difference, I am adding the libraries via composer and custom repositories for each library.

tanc’s picture

This has always been the case grshane, you will need to rename your libraries after you have downloaded. You can also do this in your composer.json by specifying the path and name in the extra section in installer-paths. For example for masonry I do this:

"extra": {
    "installer-paths": {
        "web/libraries/masonry": [
            "desandro/masonry"
        ]
    }
}

If I didn't do that then masonry would expand to a folder called masonry-3.3.2

I'll try and write a more complete example for the libraries this module uses soon but hopefully that should get you started.

tanc’s picture

Version: 8.x-2.x-dev » 7.x-2.x-dev
Status: Needs work » Needs review

Thanks @anrikun, the patch looks good. I'll need to test then will commit. I also have some other backport work to do on the D7 branch from other issues so a release might not be imminent but hopefully quite soon.

  • tanc committed 61842e0 on 7.x-2.x
    Issue #2867087 by bigjim, Grimreaper, anrikun, tanc: JS and CSS files...
tanc’s picture

Status: Needs review » Fixed
Issue tags: -Needs backport to D7

Ok folks, I think we're good! Thanks for everyones help, I'm going to close this issue

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.