These are chat archives for jescalan/roots

Feb 2017
Iain Maitland
Feb 03 2017 02:35

Hey so I did a little work on giving optional JS functionality to the roots-js-pipeline extension that I described.

Wanted to ask here if it's something worth putting a pull request in for.

Basically how I see it working is:
Optional js is added as a child list in the - manifest.yml

- vendor/googleanalytics.*
- vendor/lazysizes.*
- main.*
  - vendor/three.*

And then the js() function in the views, gets an additional argument, to attach the child list or not.

js('/', true)

Let me know if you reckon this is something others would find useful...

Iain Maitland
Feb 03 2017 14:37

To be clear: The main usefulness in this approach, seems to be a unified treatment of JS ... In particular that the js(prefix) function on views have an argument to specify if additional JS should be loaded ...

So in a common view, js(prefix)
And in a more unique view , js(prefix, include_optional_js)

It's worth noting that this approach would require an additional option for the JS-pipepline extension - something to indicate that there is optional JS down the pipe and that if/when it is encountered it should go into a separate file if the 'out' option is specified...

Jeff Escalante
Feb 03 2017 18:26
so for that type of code splitting i'd just use spike
because spike uses webpack
and its very easy to do any type of code splitting you want with webpack
Iain Maitland
Feb 03 2017 18:38
Ah ok.