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

Switch to an AST based parser and builder #26

Merged
merged 3 commits into from
Dec 9, 2013
Merged

Switch to an AST based parser and builder #26

merged 3 commits into from
Dec 9, 2013

Conversation

BYK
Copy link
Collaborator

@BYK BYK commented Dec 8, 2013

Starts using visionmedia/css-parse and visionmedia/css-stringify for
parsing the source and building the results. This avoids the messy and
hard to modify RegExes used to parse the source and makes it easier to
address issues like #19 or #18, adds the ability to add source maps and
fixes #8.

Starts using visionmedia/css-parse and visionmedia/css-stringify for
parsing the source and building the results. This avoids the messy and
hard to modify RegExes used to parse the source and makes it easier to
address issues like #19 or #18, adds the ability to add source maps and
fixes #8.
@ghost ghost assigned ded Dec 8, 2013
@BYK
Copy link
Collaborator Author

BYK commented Dec 8, 2013

According to reworkcss/css-parse#49 we need to remove any comments in property names and values manually for now. I'll update the patch according to this information.

@@ -199,7 +199,7 @@ sink('media expressions', function (test, ok, b, a, assert) {
test('should handle media declarations', function (done) {
assert.equal(
swap('@media (max-width: 320px) { #myid { margin-right: 1px; } .cls { padding-left: 3px; } } td { float: left; }'),
'@media (max-width:320px){#myid{margin-left:1px;}.cls{padding-right:3px;}}td{float:right;}',
'@media (max-width: 320px){#myid{margin-left:1px;}.cls{padding-right:3px;}}td{float:right;}',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does this extra space come from after max-width

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently our new parser/builder combo does not split or compress that part. The space is in the original and it does not go away with compression.

@ded
Copy link
Owner

ded commented Dec 8, 2013

this is a great change! this alleviates us from actually having to write the parser in R2

@@ -1,7 +1,7 @@
{
"name": "R2",
"description": "a CSS LTR ∞ RTL converter",
"version": "1.3.3",
"version": "1.4.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should do this 1.4.0 or 1.3.4

I think this can still be 1.3.4 since the interface doesn't change at all. What do you think @ded?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we added a new dependency, it's fine to move up a minor version since this could alter how folks implemented the package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright then, I think this is ready for prime time :)
On Dec 8, 2013 10:16 PM, "Dustin Diaz" [email protected] wrote:

In package.json:

@@ -1,7 +1,7 @@
{
"name": "R2",
"description": "a CSS LTR ∞ RTL converter",

  • "version": "1.3.3",
  • "version": "1.4.0",

since we added a new dependency, it's fine to move up a minor version
since this could alter how folks implemented the package.


Reply to this email directly or view it on GitHubhttps://github.com//pull/26/files#r8185911
.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool. i'll leave it up to you to merge

BYK added a commit that referenced this pull request Dec 9, 2013
Switch to an AST based parser and builder
@BYK BYK merged commit 3ea8cb1 into master Dec 9, 2013
@BYK BYK deleted the ast branch December 9, 2013 14:22
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.

Semicolons in content block can break parsing
2 participants