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

Fix parsing of comments within values #24

Closed
necolas opened this issue Jun 4, 2014 · 1 comment
Closed

Fix parsing of comments within values #24

necolas opened this issue Jun 4, 2014 · 1 comment
Labels

Comments

@necolas
Copy link
Contributor

necolas commented Jun 4, 2014

Problems parsing braces inside a comment inside a value.

.ui-corner-all {
    -webkit-border-radius:              .3125em /*{global-radii-blocks}*/;
    border-radius:                      .3125em /*{global-radii-blocks}*/;
}

Produces this error

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: property missing ':' near line 3:56

(Moved from https://github.com/reworkcss/css-parse/issues/91)

@necolas necolas added the bug label Jun 4, 2014
@lydell
Copy link
Contributor

lydell commented Jun 9, 2014

I’ve started looking at this … and while I did so, I found that the solution I envision easily could allow us to preserve such comments. I’m thinking that each node should get a raw property, which is an object. The raw object duplicates all of the properties of the node that are strings or arrays of strings and which had comments stripped from them. The duplicates in the raw object are not stripped from comments. Then css.stringify could do something like value = (node.raw.prop && stripComments(node.raw.prop) === node.prop ? node.raw.prop : node.prop); this.emit("foo" + value)—that is, use the raw value if the cleaned value hasn’t been changed. The compress compiler could ignore that, though (or perhaps allowing certain “hack” comments). What do you think about that?

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

No branches or pull requests

2 participants