For Drupal 8 users that want to maintain their site dependencies with composer and want to use the composer - npm / bower integration plug-in fxp/composer-asset-plugin then according to the INSTALL.txt instructions they are out of luck. They will have to go through the complicated process to create a custom composer install script to either move or symlink from web/libraries/masonry/dist/masonry.pkgd.min.js to the required web/libraries/masonry/masonry.pkgd.min.js

My feature request is that this module would support both locations.

CommentFileSizeAuthor
#3 composer_support-2955243-3.patch5.34 KBmatthiasm11

Comments

ñull created an issue. See original summary.

danielveza’s picture

+1. Would love this fixed. Will need it for at least one of our sites.

I'll look into providing a patch when we are closer to live if nothing has come of this by that point.

matthiasm11’s picture

Title: npm / bower support » Composer / npm / bower support
Status: Active » Needs review
StatusFileSize
new5.34 KB

The "sites/all/libraries/masonry/masonry.pkgd.min.js" (mentioned in the INSTALL.txt) is definitely a left-over from the D7 module.
Since D8 is all about using composer to manage modules and their dependencies, and I do not know of a way to add a fallback in masonry.libraries.yml, I've created a patch containing /libraries/masonry/dist/masonry.pkgd.min.js as the correct path. This ensures one can install the masonry module and libraries by composer.

If using the http://drupal.org/project/libraries module (not required for the masonry module), it may be possible to alter the path conditionally with a file_exists(). However, the functions libraries_load(), libraries_detect() and libraries_get_path() are all deprecated, so I doubt we should go that way.

japicoder’s picture

I did a review over #3 patch and this is IMHO needed. The Masonry 3.x versions and even the latest versions all of them provide the .pkgd.min.js file into the /dist folder, which means it is not detected by the module even when it's there.

+1 to have this patch commited.
Needless to say that patch #3 works for me.

markdc’s picture

Patch works. Thank you.

jcmartinez’s picture

#3 Works for me.

farnoosh’s picture

# 3 worked for me as well.

farnoosh’s picture

For anyone trying to install front-end JavaScript libraries that are required for this module: I followed this article for an Acquia/lightning project: http://lightning.acquia.com/blog/round-your-front-end-javascript-librari...
Hope it helps.

farnoosh’s picture

Status: Needs review » Reviewed & tested by the community
dom.’s picture

Hi !

I may be wrong but I wonder why we should have the masonry in the /dist folder.
Also, this is really interesting but maybe coupled with #3112871: Add dependent libraries via composer

The install.txt misses a little change because a /sites/all/libraries is left.

I will continue with a follow-up to not depend on the libraries module. It feels useless to me here.

Thanks A LOT for contribution :)
I will also report majid.ali as a contributer to this because of his contribution at #3112871: Add dependent libraries via composer.

Dom. credited majid.ali.

dom.’s picture

  • Dom. committed d82e174 on 8.x-1.x
    Issue #2955243 by matthiasm11, majid.ali, Dom.: Composer / npm / bower...
dom.’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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