Skip to content
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

Require: converter for gradients #3

Open
remy opened this issue Feb 10, 2012 · 8 comments
Open

Require: converter for gradients #3

remy opened this issue Feb 10, 2012 · 8 comments

Comments

@remy
Copy link
Owner

remy commented Feb 10, 2012

Given a string passed to a JavaScript function:

background-image: -moz-linear-gradient(bottom, #F8F8F8, #FDFDFD) !important;

...can a function return an object with all supported gradient CSS values.

Note that if a linear gradient is passed, linear gradients should return, as with radial and non-specific.

Code must also come with tests.

@niaccurshi
Copy link

Does this need to include an SVG response, or as it is not prefix specific as such is it outside the scope of this tool?

@remy
Copy link
Owner Author

remy commented Feb 10, 2012

I think it's outside the scope.

@ghost
Copy link

ghost commented Feb 10, 2012

What about the various different notations? Stuff like multiple gradients, gradients mixed with images, gradient notation in the background shorthand, etc? Or should we start with just this simple variation and expand from there?

@remy
Copy link
Owner Author

remy commented Feb 10, 2012

I'd suggest starting simple. Get the structure of the library right, so you can pass in and get you get out.

Start from there and build upwards. Right now we have nothing - so something is better than that :)

@niaccurshi
Copy link

Ok, well I have something which I can add as a starter tonight, hopefully then others can make it more efficient or add to it if I'm slow.

@ghost
Copy link

ghost commented Feb 10, 2012

I've just committed the very first version of a parser in my own fork. It only works so far for lines like the one above, without the "!important". I'll continue working on it.

Do we also need to add the old webkit syntax? That might prove to be a bit of a challenge :)

@niaccurshi
Copy link

I don't know how you've been getting on with this chevalric, but I've got a version that I'm going to fork off of yours later.

It doesn't convert from webkit-gradient to modern versions yet, and it doesn't attempt to do any conversion to -webkit-gradient for radial, and has very limited scope for converting to use "filter" for IE6-8 with linear gradients as well as not attempting to convert for filters for radial gradients. Without a DOM to interact with it would be, to my mind, impossible to create an appropriate -webkit-gradient rule for radial gradients in all but the most basic version of it.

filters are being included for completeness, though it'd be down to the user to ensure that they modify it in a way that didn't interfere with IE9-10's -ms- prefix.

Ultimately, if this tool is purely to prefix up CSS code, then it won't be able to do so in completeness nor exactness on this front, and we should accept that rather than hand over CSS code in return that would significantly differ the viewing experience across browsers, potentially to the detriment of the users design.

Extra tools could fairly easily be created to automatically create exacting SVG and/or -webkit-gradient fall backs for older browsers for inclusion on their website at runtime, or to be run on their website once if they are sure their design will not have it's elements housing radial gradients change size; but then that should be a JQuery plugin, or something similar, I feel. On the SVG front it'd be a better recommendation to point people at things like CSSPie that actually already do this job!

@niaccurshi
Copy link

Better late than never, the files/code is up on a fork of remy's cssprefix (not Chevalric as said before)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants