6

Is there a way to tell CoffeeScript to just ignore a certain line and output it as is?

I want this line to be included in the resulting javascript

#import './blah/blah'

But CoffeeScript is compiling it as a comment so it ends up as

//import './blah/blah'

I need it to not do that because the script is being used for Apple's UIAutomation Instrument to drive iPhone UI. UIAutomation recognizes special #import statements but not if they are getting turned into javascript comments.

Jacob Schoen
  • 14,034
  • 15
  • 82
  • 102
Christian Schlensker
  • 21,708
  • 19
  • 73
  • 121

2 Answers2

9

Enclose the statement with backicks (`)

`#import './blah/blah'`

You can use any JavaScript code that way.

jupp0r
  • 4,502
  • 1
  • 27
  • 34
3

Doh, found the answer in the coffeescript docs

hi = `function() {
  return [document.title, "Hello JavaScript"].join(": ");
}`
Bengt
  • 14,011
  • 7
  • 48
  • 66
Christian Schlensker
  • 21,708
  • 19
  • 73
  • 121