-
Notifications
You must be signed in to change notification settings - Fork 136
Extract source map URL from directive comments #178
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
Conversation
I don’t think this belongs in the CSS tokenizer. Could it be built on top, with |
The reason I put it into the token stream is because it seemed to me that there could be multiple parsers using a single token stream. At least, that's what I understood when I was looking into the servo side of this. In this situation, one must be careful to query whichever parser happened to see the magic comment. Perhaps in practice this isn't a problem. In normal use the directive only appears at the end of the file. |
Sorry I was unclear. I meant using |
The Source Map "proposal" is a bit unclear. Does the magic comment need to be at the very start of the stylesheet, or can it be anywhere in the middle? |
I think it can be anywhere. In practice tools put it at the end of the text. To make sure I understand, you are saying I should just close this PR and do the work in servo? I can do that; though of course it means any other user of this crate will also have to reimplement this code. |
I was saying that I’d prefer such a solution, though I don’t know how that would work exactly. But if the magic comment can be anywhere that’s more annoying: this may need to be in the tokenizer after all. Still, I’d prefer not to duplicate the inner loop of |
The text says:
It's hard to say if that is normative though. At least SpiderMonkey, and the current approach in DevTools, both allow the comment to appear anywhere. I don't know whether any tools put the comment anywhere besides the end. |
I looked a little deeper at other approaches. The end goal is to expose this value via To do that I think I would need it to be available in The contents are parsed using a rule list parser: https://github.com/servo/servo/blob/master/components/style/stylesheets/stylesheet.rs#L48 The rule list parser works primarily by callbacks. Servo provides a So maybe the work can be done here somehow. |
This may be tricky given the way This PR looks good overall, except that I’d prefer it didn’t duplicate the inner loop of
|
Change the parser to extract the source map URL from directive comments. The relevant spec is here: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx This is part of similar work being done in M-C in https://bugzilla.mozilla.org/show_bug.cgi?id=1388855
Looks good. I assume you’ll want this change on crates.io to be able to use it in Servo or Gecko, so please also change the version number in |
@bors-servo r+ |
📌 Commit 94330b1 has been approved by |
Extract source map URL from directive comments Change the parser to extract the source map URL from directive comments. The relevant spec is here: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx This is part of similar work being done in M-C in https://bugzilla.mozilla.org/show_bug.cgi?id=1388855 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/178) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
Change the parser to extract the source map URL from directive comments.
The relevant spec is here:
https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.lmz475t4mvbx
This is part of similar work being done in M-C in
https://bugzilla.mozilla.org/show_bug.cgi?id=1388855
This change is