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
Embedding with RequireJS #72
Conversation
…n get escaped to HTML entities; removing JSON dump
…uilt file. note that this looks for a setting which won't be found unless it's in the most local file (e.g., local_settings.py, vs. vanilla source settings.py). also note that there wasn't a good way to get full URLs into the require config, so they're built in by default. needs a fix of some sort.
Just to pull it out and re-emphasize, |
Thanks.
Hmm. That's a shame. The notion of hooking into collectstatic sprang to mind for me as well. That seems it should be reasonably straightforward (assuming that the hooks can be ordered -- the optimization process that django-require uses would have to come after this one.)
Just to check, did you try modifying the settings.py in viewshare_site? This is the root settings for the site project, and the settings.py in the viewshare project isn't used at all (which is something worth streamlining at some point).
If I understand correctly, this would be a potential solution to the first problem?
Yeah... Despite the above issues, this looks like a great start. I'll merge and we can deal with the above separately. |
Let's go ahead and say the collectstatic hook is the best option to explore. I'm not sure I can guarantee the correct order of operations setting the path later (e.g., it may go out to fetch an image before the path is set properly). I thought I'd tried bubbling the REQUIRE config up through the less to the more local settings files, including the |
I've made some progress with this. It turns out you can call requirejs.config multiple times, with the last call overriding any previous. If we define a global window.freemix.staticUrl in the base template, we can embed a requirejs.config() that overrides these values in the body of the main. I've validated this with a debug setup after making some modifications so that the base css and the proper main is provided. I'll make sure this works optimized, then make a separate pull request for your review. This comes with a couple of caveats. There are a couple of images that aren't loading. Also, there's an error in the EHistory module when I try to switch views. This was happening before I made these modifications, though, so probably isn't related. |
That's why I didn't pursue that strategy any farther. If you can find a way to make this work, by all means, but I couldn't. Using paths comes up pretty early in the Exhibit setup process, so config basically needs to happen before it starts. You can also pre-define a variable named There are a couple ways to hook into commands. One is just to take over the name and call the original handler when needed. Another less brute force way is that the |
This works, and should take care of line breaks and quotation marks in titles, but.
require.conf
module's settings cannot findREQUIRE_STANDALONE_MODULES
without it being inviewshare_site_settings.py
(i.e., the most local settings file) and will not find it in other settings files.loadCss: false
configuration. It currently goes out to fetch all the CSS already bundled in through Viewshare. It may also be useful to provide post-setting paths methods.