I'm curious about that solution. But I wonder if it's too specific? Would it also work with images and other resources such as SWFs?

Mike Wilcox
http://clubajax.org
mike at mikewilcox.net


On Feb 2, 2012, at 3:34 PM, Sasha Firsov wrote:

Just came over trouble with css! RequireJS plugin. The one I found, does
not work as expected and shortcut was in injection of include in header
within text! plugin:
get = function (url, callback) {
var le = $("head").append('<link rel="stylesheet"
type="text/css" href="'+url+'" />');

Relative module path work as in JS module. Which mean no need to have
fixed URLs to image resources for css rules.

I am placing this solution in DTK list since more modules will become
independent and would need as insulation on one side and referencing
from another modules from another.
The subj could be already solved, excuse for repeating than.

Details:
text.js was cloned into cssI.js which allows
"cssI!dojox/MyModule/MyModule.css" to use relative in MyModule img urls.
Patch above inserts link to CSS in header and continue to load as text
content. That is necessary for modules which using classes and styles
from CSS. SlickGrid in my case, it is sick solution, but could not
change it :/

Is the pattern of widget depend on CSS names and values a good one, not
sure. Personally I do not like it, it goes against separation of
concepts. But it could be beneficial in terms of speed and flexibility.
So given solution is reliable but slowing down widgets load which could
be skipped. In such case following patch makes "fast CSS load" without
waiting for CSS delivery:

get = function (url, callback) {
var le = $("head").append('<link rel="stylesheet"
type="text/css" href="'+url+'" />');
callback(le);
return;

While given CSS loading concepts are just ideas, it has been tested on
current IE, FF, Chrome.
Let me know if actual code patch will become handy, we could git it :)

Sasha
_______________________________________________
dojo-contributors mailing list
dojo-contributors at mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
groupdojo-contributors @
categoriesdojo
postedFeb 2, '12 at 4:34p
activeFeb 2, '12 at 4:49p
posts3
users2
websitedojotoolkit.org

2 users in discussion

Sasha Firsov: 2 posts Mike Wilcox: 1 post

People

Translate

site design / logo © 2021 Grokbase