1

I have a main coffee file and a mix of other coffee and livescript files.

# main.coffee
require 'LiveScript'
one = require './one.coffee'
two = require './two.ls'
console.log one.fun(), two.fun()

# one.coffee
module.exports.fun = -> 1

# two.ls
module.exports.fun = -> 2

I can run

coffee main.coffee

But trying to run

browserify -t coffeeify main.coffee

Gives an error:

module.exports.fun = -> 2
                      ^
ParseError: Unexpected token >

The only workaround I see is to compile ls files to js first. Is there a simpler, direct way to mix ls and coffee files?

Adam Schmideg
  • 10,590
  • 10
  • 53
  • 83

2 Answers2

0

require 'LiveScript' is only sufficient for Node.js. Browserify does not support require.extensions, and is trying to parse the LiveScript as JavaScript.

You need a transform for LiveScript as well, for example Liveify.

Kara Brightwell
  • 2,529
  • 1
  • 21
  • 29
-1

You might try Webpack. With proper loaders, e.g. livescript-loader, coffee-loader and others, you can compose your program with different js flavors.

Daniel K
  • 91
  • 1
  • 6