David Rhoderick
David Rhoderick

Reputation: 352

Bower components and Codekit 2

I have recently been getting into using CodeKit, and now version 2 is out, which is what this question regards. There seems to be great potential in using the bower components installer; however, there is little to no documentation on the working relationship between CodeKit and bower components. My code follows as:

// @codekit-prepend "../bower_components/jquery/dist/jquery.js"
// @codekit-prepend "../bower_components/PhysicsJS/dist/physicsjs-full-0.6.0.js"

Physics(function(world){

  // code straight out of the example online from the bottom of http://wellcaffeinated.net/PhysicsJS/basic-usage

});

Then I get 'Physics' is not defined. errors on any reference. This is one example but I seem to always get stuck at this point and I'm wondering: Is there a working way to use prepended libraries through CodeKit's bower components integration?

Upvotes: 1

Views: 871

Answers (1)

David Rhoderick
David Rhoderick

Reputation: 352

It seems as though I forgot something quite simple. It took me hours to figure out that simply adding $(document).ready(function(){ at the beginning and closing those tags at the end fixed the problem. Not sure exactly how that works if the libraries are in the same file but I guess it adds a little delay to the execution of the code, allowing the libraries to be considered for the code that follows.

Upvotes: 1

Related Questions