Closed kirly-af closed 4 years ago
Let's consider the following use case:
'use strict'; const pp = require('preprocess'); require('shelljs/global'); const context = {BAR: 'foobar'}; pp.preprocessFile('./in.js', './out.js', context, () => { echo('js:'); console.log(cat('out.js')); }); pp.preprocessFile('./in.coffee', './out.coffee', context, () => { echo('coffee:'); console.log(cat('out.coffee')); });
// in.js var foo = "/* @echo BAR */";
# in.coffee foo_undef = '# @echo BAR ' foo = # @echo BAR foo_workaround = """ # @echo BAR """
This will produce the following output:
js: var foo = "foobar"; coffee: foo_undef = 'undefined foo = foobar foo_workaround = """ foobar """
As shown with the 1st coffee example (foo_undef), Coffeescript syntax currently does not allow to preprocess strings with @echo on a single line.
foo_undef
@echo
An alternative syntax for convenience could be:
foo = ' ### @echo BAR ###' # output: foo = 'foobar'
Let's consider the following use case:
This will produce the following output:
As shown with the 1st coffee example (
foo_undef
), Coffeescript syntax currently does not allow to preprocess strings with@echo
on a single line.An alternative syntax for convenience could be: