kriszyp / xstyle

A declarative, reactive framework that extends CSS

Home Page:http://kriszyp.github.com/xstyle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dojo Build Plugin

urgetech opened this issue · comments

I use XStyle with the Dojo Build system and there is no plugin for the builder to support xstyle/css! bundling of the CSS text. It also looks like the css plugin (xstyle/css!) cannot handle inlined text, since, when I created the needed plugin, it still tries to dynamically call the server to load CSS that has already been included in-line with the call.

Have you looked at https://github.com/kriszyp/xstyle/blob/master/css.js#L46-L60 to see how xstyle/css! checks to see if css module has been loaded? The plan was that the build system plugin could directly inline the CSS text into the built JavaScript by assign to the cssCache global (actually line #46 should probably use require.toAbsMid). So for example, if you have a dependency of xstyle/css!pkg/css/stylesheet.css, the build plugin should inline the text of the stylesheet:

cssCache["pkg/css/stylesheet.css"] = ".my-rule{color:red;....";

Alternately xstyle/css! could check also check for the presence of a rule identifying the stylesheet, if keeping it in css files is preferable.

Have you already created a plugin for the builder? Would you be willing to contribute that to xstyle (under CLA)?

I have written something that is working but it is more convoluted than your suggestion. I will try out your suggestion and see how that works. I don't mind contributing the result at all. Note, for the plugin to be used, the build/buildConfigDefault.js file in Dojo's util/ tree has to be modified as well; I guess that is just an addendum to the README.

@urgetech you should be able to make it work without modifying build/buildControlDefault.js directly. you should be able to have a plugins property in your profile and it should get mixed into the default plugins property. can't say i've tried it myself but that's how it should work

It turns out that adding something to the cssCache is not supported in the basic plugin operations supported by the writeAMD part of the Dojo Builder. If could change the css.js file to reference the cssCache OR the Dojo cache, then I can make this work simply.

Any thoughts?

@urgetech I don't suppose you could put your work so far up somewhere, I really want a build plugin for xstyle.

We're using xstyle as part of dgrid; but we can't get a build working using your README. Can you suggest how we can build our app?

We've used:

plugins: {
    "xstyle/css": "..\thirdpartylibs\xstyle\build\amd-css"
},

and:

packages:[ 
    {name: "dojo", location: "../dojo-release-1.8/dojo"}, 
    {name: "dojox", location: "../dojo-release-1.8/dojox"}, 
    {name: "dijit", location: "../dojo-release-1.8/dijit"},
    {name: "dgrid", location: "../thirdpartylibs/dgrid"},
    {name: "xstyle", location: "../thirdpartylibs/xstyle/build/amd-css"},
    {name: "put-selector", location: "../thirdpartylibs/put-selector"}

]

But am getting malformed url errors from using the plugins option, or the following when adding in the package:

error(311) Missing dependency. module: xstyle/build/amd-css; dependency: build/fs
buidl
calling original define
error(311) Missing dependency. module: xstyle/build; dependency: build/fs
error(311) Missing dependency. module: xstyle/ext/bind; dependency: xstyle/elemental
error(311) Missing dependency. module: xstyle/shim/transition; dependency: ../elemental
error(311) Missing dependency. module: xstyle/ext/event; dependency: ../elemental
error(311) Missing dependency. module: xstyle/ext/widget; dependency: ../elemental

Sorry, per the first line of the build docs:
"This functionality is not implemented yet"
I am working on it. I assume you can still do a dgrid build without the CSS building functionality?

If I comment out xstyle from the packages, my build has errors. If I have it in, as shown above it throws the 311 errors.
How would you suggest building dgrid without it?

You shouldn't comment out the xstyle package. Are the missing dependency errors blocking the build or just outputting errors? I will try to clean those up.

The errors output in the log aren't stopping the build locally, but our CI system is failing the build as there are errors present.

I am suffering from the same issues as ippon-solutions currently when using 0.1.3 to build dgrid. Have you made any progress on this?