-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CommonJS compatibility #480
Comments
Yes, this is difficult. Masonry primarily uses Bower for package management. I'm trying to work on back-filling the other package managers (see component issue #426 ) |
browserify can use bower without issue, using debowerify so the main issue is the declaration of the component & it's dependencies a la CommonJS is missing :) |
SO is there a quick fix for this issue? I'm kind of done with AMD and i love the Brosweify workflow but it's a pain to work with indeed. debowerify and deamdify come a long way but not far enough ... |
try degloballify maybe ? |
I tried but i'm just progressing from error to error. I can't get it to work. |
Sorry but I can't help you more, I switch to something simpler that is enough for my need (all block are same width) https://github.com/rnmp/salvattore/ |
+1 |
I gave it a valiant effort, but I couldn't manage to get Masonry working with browserify either. So far, this is the only library I've come across that I couldn't get working one way or another. |
@MoOx you may find the same problem in this thread which may help you desandro/imagesloaded#119 (comment) |
+1 |
1 similar comment
+1 |
I'm slowly working on getting Masonry all ready for CommonJS, so you can use it with Browserify or Component. This is coming! but in due time. |
I am not sure if this works perfectly yet, but it might help someone in the mean time:
and
I will repost if I find any problems while I debug. |
Is there any examples of this working with CommonJS modules? I am trying to use with browserify and seems I need quite a few other dependencies. |
@joshhornby ^ the stuff I posted just above (package.json) is actually how I got masonry to work with commonjs using browserify... so it should work for yourself as well (might have to fix links obviously though). |
Ah right brilliant, so was just a case off adding these to your package.json and then running a bower install to pull in the packages etc? (Sorry I am knew to this CommonJS way of working) |
@joshhornby yup; It also uses browserify-shim; the 1st part is "browserify-shim" in package.json; the 2nd is "browser". |
@AlexRiedler Could you provide more detailed instructions or a PR on where those fields go? I haven't been able to get masonry into browserify from an NPM package. thanks! |
This morning I forked and added CommonJS support to Masonry as well as the dependencies that were missing it. I have this working with browserify in my project now. The result can be found here: https://github.com/braznaavtrav/masonry I will be making pull requests some time soon. In the meantime, you can add |
thanks @braznaavtrav will give it a shot. |
Hi @braznaavtrav ! I've tried your fork, but it cannot pass browerify:
Is it work for you and did I miss anything? Thank you! |
@toksea Yes, it is currently working for me, but I did run into a similar issue with that 2 days ago, while I was making these changes, this is the commit where I cleared up the issue you are having: tramck/outlayer@06bdc27 . Are you sure that Just to make sure, I just ran |
Hi @braznaavtrav, I checked again and change Thanks! |
@toksea good catch!! I don't know why that wasn't throwing an error for me. |
Great work @braznaavtrav and @toksea, Masonry now officially supports CommonJS! |
That is great news! Thanks!
|
I should not have said "officially supports" because there is no official Please check: #480 Sorry for any misinterpretation. On Mon, Nov 17, 2014 at 10:53 AM, Travis McKinney notifications@github.com
|
update jQuery Bridget v1.1.0 update docReady v1.0.4 update getSize v1.2.0 update Outlayer v1.3.0 Ref #480
update jQuery Bridget v1.1.0 update docReady v1.0.4 update getSize v1.2.0 update Outlayer v1.3.0 Ref #480 Conflicts: package.json
Masonry v3.2.0 supports CommonJS and Browserify 🎈 🎉 💝 npm install masonry-layout var Masonry = require('masonry-layout');
var msnry = new Masonry( '#container', {
columnWidth: 220
}); See docs at http://masonry.desandro.com/appendix.html#browserify My thanks to @braznaavtrav for getting the ball rolling 😁 |
There you go! Fantastic. |
Closing as fixed. If you run into another problem with CommonJS or Browserify, please open a new issue. |
From changelog.md : + imagesLoaded no longer included Why ? |
@kopax imagesLoaded is a separate project that solves a separate problem, for this reason, it should be kept separate. imagesLoaded has not been included with Masonry as of v3, which has been out now for 1.5 years. |
Hi! There is still one build method that's not working for Masonry: using browserify with standalone scripts (not installed via npm and thus with no node-modules dependencies, but just stored in folders). E.g. the structure like this:
Now browserify (node-version) throws All other libraries/plugins I've met so far, both designed with module.exports ans without it, could be made working this way. I understand, this might not be of any priority; just thought it would be fair noticing. |
@bonfish Thanks for reporting this issue. As you have guessed, I don't feel this is a common use case. If you're using browserify, then you should be installing Masonry with npm. |
Trying to figure this out. I'm using masonry 4.0 running gulp with browserify. I keep running into the same error: [Error running Gulp] Error: module "./item" not found |
@achord Please open a new issue, thanks! |
It's currently a pain in the ass to use masonry (so outlayer & friends) in a commonsjs environnement (in my case browserify).
You should take a look to UMD (eventually this part) to handle the 3 styles CommonJS, AMD & oldschool way.
The text was updated successfully, but these errors were encountered: