Closed nalbion closed 10 years ago
...I've tried soynode.setOptions({ contextJsPaths: closurePath + '/closure/goog/base.js' });
and soynode.setOptions({ contextJsPaths: closurePath + '/closure/goog/bootstrap/nodejs.js' });
...but that didn't seem to work...
You need to compile without --shouldProvideRequireSoyNamespaces
?
that doesn't sound right.
isn't the soyutils support code supposed to declare this? https://github.com/Medium/closure-templates/blob/master/javascript/soyutils.js#L43
if goog isn't defined, that probably means the support code isn't loading properly
soyutils doesn't stub out goog.provide and require.
ah you're right
Is there a way that I can use soynode with goog.provide/require()? My front-end uses closure and it makes sense to use the same soy.js file...
You'd probably need to monkey patch soyutils that soynode sucks in.
-- Dan
On Thu, Jun 12, 2014 at 3:14 PM, Nicholas Albion notifications@github.com wrote:
Is there a way that I can use soynode with goog.provide/require()? My front-end uses closure and it makes sense to use the same soy.js file...
— Reply to this email directly or view it on GitHub https://github.com/Medium/soynode/issues/22#issuecomment-45954879.
No luck there - even with soynode.js hacked with var PATH_TO_SOY_UTILS = closureTemplates['soyutils_usegoog.js']
and my app with:
contextJsPaths: [
closurePath + '/closure/goog/base.js',
closurePath + '/closure/goog/bootstrap/nodejs.js'
]
I get Fatal error: goog is not defined
when trying to run soyutils_usegoog.js:39:1
I think I'll just have to generate a second version of the .soy.js files into a different location. ...it only takes a moment...
Could you please provide an example of how to use
soynode.loadCompiledTemplates()
with pre-compiled.soy.js
files?My .soy.js files look like this, and soynode throws
Fatal error: Object [object Object] has no method 'provide'