Closed ComLock closed 8 years ago
Enonic has its own require: http://xp.readthedocs.org/en/stable/developer/ssjs/global-objects.html?highlight=require#require
So node_modules is not really accessable.
I guess I could try making a webpack with slm, fs, vm and path.
slm_browser.js got me a bit further.
TypeError: str.split is not a function https://github.com/slm-lang/slm/blob/master/lib/parser.js#L122
My bad, takes a string. Some documentation would be lovely.
javax.servlet.ServletException: com.enonic.xp.resource.ResourceNotFoundException: Resource [website:/site/node_modules/slm/lib/vm_browser.js#11:9<eval>] was not found
If I use render and set filename to be the slm file in options it works :)
Now I just have to figure out how to do a foreach, would be nice with a documentation example of that.
This is the syntax I tried to copy: https://github.com/slm-lang/slm/blob/00296f724d6b78e54dae604807ae85d90492df87/test/core/code_structure.js#L232-L233
This is my code (which does not work)
- this.buttons.forEach(function(button))
a.button href=button.url = button.label
And gives me this probably unrelated error. (There are typically just 1 or 2 buttons)
javax.servlet.ServletException: java.lang.IndexOutOfBoundsException: start index (43) must not be greater than size (18)
Tried this syntax too: https://github.com/slm-lang/slm/blame/master/README.md#L116
Maybe it's because I'm trying to set an attribute, nope removing that did not help, hmmm.
Turns out this.buttons was empty, and my
- if this.buttons.length
Was not good enough.
Your package.json states no dependancies, but I can find several:
I'm trying to use slm with this CMS https://enonic.com/
Which is using thymeleaf by default. Slm is a lot slimmer :) me want.
The runtime is java, but the controllers are written in javascript.
All I really need is to slm.compile a slm file, passing in a model.object (a basic hash), and get back some html. Do I need Node VM, etc for that?
Could slm be shipped as a webjar? http://www.webjars.org/