-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A question about the compiler. #6
Comments
Hi @gotno sorry for the delay. riot is split in two parts: the runtime and compiler. |
I have plans to add some configuration to point to a different compiler file. So you can easily update the compiler without forking the gem. |
thanks for the reply, @marcioj the problem i ran into was this, on line 256 of that compiler: var doc = window.document, that's the runtime compiler, which compiles .tag files in browser. maybe it was different when this gem was first created, but the server-side compiler now looks like this: https://github.com/riot/riot/tree/master/lib/server, which is meant to be run on a node-based framework like express or koa. i was hoping you might have some insight as to how to build all of that into a flat file to avoid all the require.js stuff that rails doesn't handle, but maybe it just wasn't necessary to do that when this gem was first built. |
made a little more progress with this, but it's still kind of a mess. cloned the riot repo, added this to /lib/server-compiler.js: // /lib/server-compiler.js
import 'server/parsers'
import 'server/analyzer'
import 'server/sdom'
import 'shared/compiler'
import 'server/compiler'
import 'server/index' added this line to the Makefile, under the 'raw' section: @ $(SMASH) lib/server-compiler.js > $(DIST)riot_compiler.js and run
getting closer! but rails complains it can't find the simple-dom module. makes sense because that's an npm module. looking closer, i found that /lib/server/sdom.js requires both 'simple-dom' and 'simple-html-tokenizer'. ok, let's build them in too, just to see what happens. i pull out the built js files from node_modules, throw them in the server directory, add them to the server-compiler.js manifest and build again. eslint tests fail so i comment them out of the make file. the build succeeds, but now i get some really strange javascript error from rails because this is probably the worst possible way to do what i'm trying to do. ha. i'm going to look into using commonjs.rb next, as that could make building the compiler unnecessary, but for right now i have to give it a rest. |
Hi @marcioj, you seem to be the most active contributor to this repo, so I thought I'd direct this question to you.
I wanted to upgrade to the latest version of riot, so I forked the repo. Swapping out the riot.js file was easy, but I spent a lot of time yesterday trying to figure out how to update the compiler with no luck. It turns out I may not have needed to expend the effort, as the old compiler seems to work fine with the new version of riot (so far).
My question is: how was the version of the compiler in this project built? The official server compiler is set up to run on node/io.js with require.js. Would you care to share with me how you were able to compile that js into the flat file that appears as riot_compiler.js in this repo?
Thanks!
The text was updated successfully, but these errors were encountered: