6

How can one use code in a LiveScript file from another LS file? For example:

# In script-one.ls
foo = 5

# In script-two.ls
bar = -> foo + 3

Simply including both files in the HTML via script tags does not seem to work. Changing the first script to export foo = 5 and using require! './script-one' (or variants) in the second script doesn't work either.

And what about circular dependencies?

Lokkij
  • 424
  • 4
  • 15

1 Answers1

2

LiveScript simply compiles to javascript. The module format is your decision just like in JS.

The export keyword simply compiles to a commonjs exports.foo = right now and will not work in browsers without using something like browserify (http://browserify.org/) to bundle your modules (ES6 compat is planned in the future).

Rick
  • 508
  • 4
  • 9