Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Bug Related to Stylesheets Found #205

RaafaRB opened this Issue · 2 comments

2 participants


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.


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)


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
@sigmavirus24 sigmavirus24 added this to the Version 1.0 milestone
@sigmavirus24 sigmavirus24 self-assigned this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.