Plugin "document.write" messes up RequireJS
-
MadRabbit
Hey Juho,
I've never worked with requirejs need to check it out what's the problem. But I was wondering how is that possible that there is no
document? do they eval it on the server side or something? because there is always adocumentreference in any window. In fact a the place where you include your first script there is already HTML and HEAD tags exist. -
Juho Vepsäläinen
I'm not familiar with the technical details. I know that it's definitely not a server side solution. There's more information at http://requirejs.org/docs/why.html . Hope that helps. :)
On longer term it might be interesting to migrate to use some form of theme system. I know there may be some overhead (unneeded CSS ie.) but it just could be worth it, particularly for those using multiple plugins.
-
MadRabbit
what do you mean by "theme system" ? do you mean skins?
-
Juho Vepsäläinen
Yup. I think jQuery UI provides a nice example of this. See http://jqueryui.com/themeroller/ .
-
MadRabbit
yes, we're kinda working on it. in rightjs ui 2 all the styles were cleaned up for that, plus there are couple of guys drawing things for skins. just with the release and stuff didn't have time to finish everything up
-
Juho Vepsäläinen
Ok. Cool. :)
-
MadRabbit
- Tag set to enhancement, ui
Hey Juho,
I've finally took care of the issue. I've cleaned up RightJS core itself from all the evals and document.writes and reworked the UI modules a bit differently, they still have the styles inlined but don't use document.write anymore.
I'm attaching all the fresh builds, please give them a spin when you'll have a moment.
-- and yeah, UI modules should be fine, but I'm not sure about RightJS core with a separated olds module, it uses some dark voodoo to determine the url from where to load the patch, so you might wanna check it out and use an all-in-one build or something.
LMK how it went
-
MadRabbit
- State changed from new to resolved
-
Juho Vepsäläinen
Thanks!
I'll try to give it a go soon and let you know how it works out. I think just getting rid of that "document.write" part helped a lot as that messed up the script loading before.
The author of RequireJS whipped together a module conversion script for jQuery UI btw. See https://github.com/jrburke/jqueryui-amd . I don't mind monkey-patching my RightJS code. Still something like that might make a good TODO later on. This is true especially if RequireJS and similar tools become more popular. I personally don't see why not considering having proper modules in JS is a huge boon for development.
-
MadRabbit
can't disagree on that. I'm actually thinking about having some sort of rjs based loader, just didn't get to it for real yet. will get to it a bit later
-
Juho Vepsäläinen
Just gave your package a go. Once I finished up replacing the old code with your one it ran just fine. No loading errors whatsoever. :)
-
MadRabbit
Sweet. Thanks for heads up!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
