How to include another LiveScript file in LiveScript?

How can I use code in a LiveScript file from another LS file? For instance:

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

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

What about circular dependencies?

+6
source share
1 answer

LiveScript just compiles in javascript. The module format is your decision, as in JS.

export keyword just compiles before CommonJS exports.foo = right now, and will not work in browsers without using something like browserify ( http://browserify.org/ ) to merge your modules (ES6 compat is planned in the future).

+2
source

Source: https://habr.com/ru/post/987213/


All Articles