Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Bug Related to Stylesheets Found #205

RaafaRB opened this Issue Oct 18, 2013 · 2 comments


None yet
2 participants

RaafaRB commented Oct 18, 2013

Man, I've been struggling aggainst this all day, but it is finally over.
I was adding some stylesheets directly through PDFKit's stylesheets attr_reader, and then calling 'to_pdf' on it, to make the convertion.

BUT, the first line of code inside 'to_pdf' calls another method named 'append_stylesheets', wich makes an insertion to the kit's @source variable for each stylesheet inside the array. The thing is, the insertion is always made at the index 0, and this innocently reverts the array order of elements, changing the css inheritance tree upside down.

Occasionally my first css class name is 'reset', and you can imagine why it is named that way, and the results weren't quite the expected.

I assume this insertion index choice has a reason, but it realy shouldnt affect the stylesheets order at the end.


sigmavirus24 commented Oct 20, 2013

I'm intrigued that this hasn't been an issue before. I'll see if we could possibly perform the insertion in order, but I suspect that might be difficult. (It may also be that I haven't looked at this particular section in a while and am forgetting it)


sigmavirus24 commented Aug 7, 2014

I'm a bit wary of changing the insertion order before 1.0 given that people may actually be relying on this behaviour. With that said, for now you could call #reverse on the Array you're passing in to ensure it has the right ordering when inserted into the @source variable. I'll mark this as a feature for v1.0 though.

@sigmavirus24 sigmavirus24 added the feature label Aug 7, 2014

@sigmavirus24 sigmavirus24 added this to the Version 1.0 milestone Aug 7, 2014

@sigmavirus24 sigmavirus24 self-assigned this Aug 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment