Skip to content
This repository has been archived by the owner on Jan 12, 2018. It is now read-only.

Commit

Permalink
Absolute paths in build (so we can run in npm)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Nicklas and Kim Burgestrand committed Nov 6, 2014
1 parent 6bef9df commit a8f86e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/build.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Build =

js = require('./grammar').Parser.generate({ moduleType: "js" })
coffee = ""
coffee += fs.readFileSync("./src/#{name}.coffee").toString() for name in @sourceFiles
coffee += fs.readFileSync(path.join(__dirname, "#{name}.coffee")).toString() for name in @sourceFiles
js += CoffeeScript.compile(coffee, bare: true)
"""
(function(root) {
Expand All @@ -71,10 +71,10 @@ Build =

context = vm.createContext(sandbox)
for name in @sourceFiles
path = "./src/#{name}.coffee"
source = fs.readFileSync(path)
data = CoffeeScript.compile(source.toString(), bare: true, filename: path)
vm.runInContext(data, context, path)
filePath = path.join(__dirname, "#{name}.coffee")
source = fs.readFileSync(filePath)
data = CoffeeScript.compile(source.toString(), bare: true, filename: filePath)
vm.runInContext(data, context, filePath)

context

Expand Down

0 comments on commit a8f86e6

Please sign in to comment.