javascript - How do I get TextMate to see "require" expressions in CoffeeScript when compiling? -



javascript - How do I get TextMate to see "require" expressions in CoffeeScript when compiling? -

when writing coffeescript in textmate , wanting utilize 3rd party javascript library jquery or raphael there need add together "require" so:

$ = require 'jquery'

this works fine when using coffee -c myfile.coffee commandline, fails in textmate bundle when trying compile error:

error: cannot find module 'jquery' @ function._resolvefilename (module.js:317:11) @ function._load (module.js:262:25) @ require (module.js:346:19) @ object. (.:3:7) @ object. (.:4:4) @ module._compile (module.js:402:26) @ object.run (/usr/lib/node_modules/coffee-script/lib/coffee-script.js:62:19) @ /usr/lib/node_modules/coffee-script/lib/command.js:120:29 @ socket. (/usr/lib/node_modules/coffee-script/lib/command.js:154:14) @ socket.emit (events.js:61:17)

in example, code in same directory @ root of project.

the same occurs when specifying:

$ = require 'jquery.js'

how other people compiling in coffeescript textmate bundle? seem showstopper me trivial code. apart syntax highlighting, certainly 1 of of import parts of bundle?

you've nail "run" command (⌘r), equivalent coffee myfile.coffee.

you want "compile , display js" (⌘b), equivalent coffee -c --print --bare myfile.coffee. should open window compiled output

var $; $ = require('jquery');

as require-ing libraries jquery , raphael, hope understand require runtime function loading modules; has no compile-time meaning. may coming language c++ or java there's "linker." in coffeescript, on other hand, code compiled javascript 1 file @ time, , javascript files loaded individually runtime environment (be browser or framework node.js).

javascript jquery textmate coffeescript

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -