It'd be great if the config could be part of the require.js download instead of being duplicated on every page. For complex apps, the config could get quite large so caching it is ideal.
At the same time, it would be nice to be able to include a few other assets with require.js such as some essential libraries that you want to be available ASAP without another round-trip. A good example of this would be an image lazy loading library that you might use on every page.
I tried to tackle both these issues in https://github.com/paperculture/requirejs-rails/commit/0dfd7e4567a69fd5dd0f1a34ae3dbed2b90334fa where require.js is loaded by bootstrapper.js.erb and I expose the require.js config as a helper. It almost worked, but the checksums for each asset filename are wrong in the generated require.js config presumably due to the order that things were generated in.
I'm not super familiar with the asset pipeline, is there an easy fix for this?
It'd be great if the config could be part of the require.js download instead of being duplicated on every page. For complex apps, the config could get quite large so caching it is ideal.
At the same time, it would be nice to be able to include a few other assets with require.js such as some essential libraries that you want to be available ASAP without another round-trip. A good example of this would be an image lazy loading library that you might use on every page.
I tried to tackle both these issues in https://github.com/paperculture/requirejs-rails/commit/0dfd7e4567a69fd5dd0f1a34ae3dbed2b90334fa where
require.js
is loaded bybootstrapper.js.erb
and I expose the require.js config as a helper. It almost worked, but the checksums for each asset filename are wrong in the generated require.js config presumably due to the order that things were generated in.I'm not super familiar with the asset pipeline, is there an easy fix for this?