_.template causes 'unsafe-eval' error


Attempting to use _.template to make template functions and make it easier to generate urls.

When this happens i get the following error:

“Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: “script-src ‘self’”.”

Is there a way to disable this?

If not what is there any way to use template strings or templating within atom?

Unsafe-eval error in package?

This module may be some help: https://github.com/atom/loophole

Underscore uses the Function constructor, so you would need:

{allowUnsafeNewFunction} = require 'loophole'
template = allowUnsafeNewFunction -> _.template(...)

Support for eval() in Workers

Thanks. This works great.