How to make riot.route optional? #1485

cognitom opened this Issue Dec 27, 2015 · 9 comments


None yet

7 participants


We've decided to make riot.route optional. #1322
I'm guessing what's the best way...


It could be like this:

  • riot.js
  • riot+route.js
  • riot+compiler.js
  • riot+compiler+route.js


Another option is loading separately:

<script src=""></script>
<script src=""></script>

But it feels bit inconsistent.


Should we separate compiler, too?

<script src=""></script>
<script src=""></script>
<script src=""></script>

Any thoughts? Thanks!


BTW, for Browserify and WebPack, it'll be more simpler:

var riot = require('riot')
riot.route = require('riot-route')

or just:

  riot  = require('riot')
  route = require('riot-route')

@cognitom , please B. I just was thinking about the parsers.

I think we must remove all the parsers and release riot with a subfolder with these and other optional "core" components, like the router, the compiler, maybe an alternate styleManager, and so on (custom tmpl for precompiled expressions).

Example: Include a pre-made default version of riot for browsers only --i.e. unminified, no compiler/commonjs/router.
Then, with an included tool the user can make a custom version of riot, like underscore or zepto already does:

mkriot --compiler --router --parser babel -o js/riot

just an idea.


I already do something like this with the compiler using jspreproc. This allows me to generate optimized versions for the CLI and riot with the same code base.


Optional route! YAY.

jpodwys commented Jan 7, 2016

I use browserify so I don't care how you separate them, but I'm excited for this!

cognitom commented Jan 7, 2016

Thanks for your feedbacks, guys!
@aMarCruz ok, let's go with B.


  • make a copy of this file into the root directory of riot/riot
  • remove the tests for riot/route from riot/riot
  • update the documents

I think this topic is really important because it will affect the rollup build, I will do some tests guys in the rollup branch and I will let you know the simplest solution


B' appeals to me - I don't know of any advantage for them being all in the same file.

But like jpodwys, I use Browserify, so all I really care about is you pulling the trigger on some method and publishing a smaller module to npm!

@GianlucaGuarini GianlucaGuarini referenced this issue Mar 19, 2016

Riot 3.0.0 roadmap #1694

14 of 16 tasks complete
kazzkiq commented Mar 21, 2016

Agree with @TehShrike as B' seems more appealing. This helps in separating scopes and making Riot more flexible and modular.

And everyone uses task-runners and/or module-loaders nowadays anyways, all those independent files could easily be concatenated or loaded on demand in production. No big deal on performance topic.

@GianlucaGuarini GianlucaGuarini added this to the 3.0.0 milestone Oct 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment