1

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

1
  • 3
    Rather than editing your question and putting [SOLVED] in the title, you should post your resolution as an answer to your question, and accept it. Commented Jun 14, 2013 at 16:08

1 Answer 1

1

Solved with the help of An AMD loader plugin for CoffeeScript

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.