Search code examples
javascriptcoffeescriptios-ui-automation

Have CoffeeScript output a line as raw javascript?


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.


Solution

  • Enclose the statement with backicks (`)

    `#import './blah/blah'`
    

    You can use any JavaScript code that way.