-
Notifications
You must be signed in to change notification settings - Fork 8
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
requireJS javascript dependancies #1967
Comments
Thinking of making this a little more generic. A couple use cases:
So I'm thinking if we can just make this a little more generic by doing something like:
and then later in footer or whereever
The 3rd arg is arbitrary for require, and is just anything. It's only for the JS scope that is has a special meaning, so the full function signature could be: % require(scope, key, value); All are strings, value is optional. required(scope) returns an order list of a key => value pairs. |
this is really good. I presume we are going to roll our own. |
yeah this should only be a few lines of code |
done a while ago |
From @brendanheywood
So the topo template would say something like
% requireJS('topo.js', 'Modernizr.inlinesvg');
So the topos will only get loaded in a browser that can support them.
% requireJS('maps.js', 'window.matchMedia( "(min-width: 500px)" ).matches');
So that the full google maps widget will only load if the browser window is over a certain size(otherwise fall back to a static map).
This expression would need to be available to the footer template to render into the javascript to execute the test and then write the script tag if it passes
The text was updated successfully, but these errors were encountered: