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

Parse Comments #15

Merged
merged 1 commit into from Mar 18, 2013
Merged

Parse Comments #15

merged 1 commit into from Mar 18, 2013

Conversation

ForbesLindesay
Copy link
Contributor

This parses comments and they appear in the output as {"comment": "comment test"} e.g.:

/* http://foo.com/bar/baz.html */

foo { /*/*/
  bar: baz; /* http://foo.com/bar/baz.html */
}

becomes

{
  "stylesheet": {
    "rules": [
      {
        "comment": " http://foo.com/bar/baz.html "
      },
      {
        "selectors": [
          "foo"
        ],
        "declarations": [
          {
            "property": "bar",
            "value": "baz"
          }
        ]
      }
    ]
  }
}

Note that it ignores any comments that aren't either top-level or direct descendants of @media queries.

I'd add support for direct descendants of @keyframes but it would break https://github.com/visionmedia/rework/blob/master/lib/visit.js so that needs to be fixed to check if (keyframe.declarations) first.

Closes #13

@ai
Copy link

ai commented Mar 14, 2013

+1, for example Rails Assets Pipeline use comments directives to join CSS files, so this issue will blocking to create rework-rails.

@kristoferjoseph
Copy link

+1 for this since kss comments are widely used to generate style guides.

tj added a commit that referenced this pull request Mar 18, 2013
@tj tj merged commit c09d5fc into reworkcss:master Mar 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants