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

Search Discussions

  • Mike Wilcox at Feb 2, 2012 at 4:38 pm
    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
  • Sasha Firsov at Feb 2, 2012 at 4:49 pm
    It is only 2 CSS include methods.
    I agree that for module loader to be complete needs few other plugins as
    well:
    xml!
    img!
    svg!
    json!

    you name it. Most could be simulated or post-processed via text! plugin.
    Which is far from native, but acceptable and working solution.
    Would love to get on those, do not have $ time though.

    Sasha

    On 2/2/2012 1:38 PM, Mike Wilcox wrote:
    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
    _______________________________________________
    dojo-contributors mailing list
    dojo-contributors at mail.dojotoolkit.org
    http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors

Related Discussions

Discussion Navigation
viewthread | post
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