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

Avoid exception when stylesheet has no style rules. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lananelson
Copy link

In some cases JS parser (kss.js) does not work as expected.
I have a stylesheet from Typekit that is included before any other stylesheets.
All it has is @font-face at-rules.

These rules will not be retrieved here:

ref2 = stylesheet.cssRules;

As a result _ref2 is null and exception thrown on the following line

for (idx = 0, _len2 = _ref2.length; idx < _len2; idx++) {

That results in termination of the outer loop (line 11) and consequently none of the remaining stylesheets that were included after the Typekit stylesheet are parsed.

Since this project probably compiles CoffeeScript from http://github.com/kneath/kss I am not sure whether or not it makes sense to have this bug fixed here. I am going to send a pull request for CoffeeScript as well in the KSS project.

@seanbrant
Copy link
Owner

Thanks for finding this!

Can you file a bug with main ruby version [1]? I'd like to keep pykss's version the same as the one in the ruby repo. In a perfect world we wouldn't bundle our own version of kss.js though I haven't given much thought about how that would work.

I keep an eye on [1] so once your fix makes it in I will update kss.js.

[1] http://github.com/kneath/kss

@lananelson
Copy link
Author

Sure that sounds good!

@lananelson
Copy link
Author

I think we can close this now because it seems that the bug was fixed in ruby version.
See
kneath/kss#62

and

kneath/kss#83

@lananelson lananelson closed this Feb 27, 2014
@lananelson lananelson reopened this Feb 27, 2014
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

Successfully merging this pull request may close these issues.

None yet

2 participants