Reputation: 3451
What is the best way to combine coffeescript with requirejs ? I am confused with coffeescript self invoking function - by default all properties are not visible outside of that function (after compiling ). If I do something like this with requirejs using coffee:
// requirejs module
define=(do()->
this.app =
someproperty: "property" // export to global scope
)
Then app object will be globally accessible, and not just inside main require module.
So trying to access app object inside of main require module will fail:
require("modules/modulename",function(name){
name.app.some // this will fail
this.app.someproperty // this works but it is global
})
How to make module created with coffeescript visible only inside requirejs main script ?
Thanks
Upvotes: 1
Views: 6358
Reputation: 3451
Solved with the help of An AMD loader plugin for CoffeeScript
Upvotes: 1