ocamlocsigen

Ocsigen/Eliom: How to remove unnecessary JavaScript?


I'm taking my first steps in web programming with the Ocsigen framework. I can build simple apps, but I've noticed that Ocsigen generates loads of unnecessary JavaScript code. Even the Hello world example, which has no interactive components at all, generates and includes a 400 KB JavaScript file. Is there a way to tell it not to do that?

I first noticed this issue while testing a simple app that was using internal links; testing with JavaScript turned off worked fine, but with JavaScript turned back on, I noticed that each link actually had an associated piece of JavaScript that I didn't write and can't control. Obviously, this code is not needed if the site works just as well without it. I would really like to avoid that. Any tips?


Solution

  • That's produced if you use the Eliom_registration.App functor. You can use Eliom_registration.Html5 if you don't use javascript, and it will generate a plain html page without any magic in it. On the flip side, it means that you can't use client values.