LiveScript icon indicating copy to clipboard operation
LiveScript copied to clipboard

allow string interpolation in `require!`

Open summivox opened this issue 9 years ago • 0 comments

Because I want to use https://github.com/inxilpro/node-app-root-path like a boss

root = require 'app-root-path'
require! "#root/index": index

or simply

require! {
  'app-root-path': root
  "#root/index": index
}

This is currently rejected by ast.Require#compile because a string interpolation is an expression, not a literal, but it can be easily fixed.

Of course this should only work in the "interpolated": assignee format.

I could have written

root = require 'app-root-path'
index = require "#root/index"

but then I lose the nice grouping of require!.

summivox avatar Jun 10 '16 14:06 summivox