{"action":"created","issue":{"url":"https://api.github.com/repos/postcss/postcss/issues/754","repository_url":"https://api.github.com/repos/postcss/postcss","labels_url":"https://api.github.com/repos/postcss/postcss/issues/754/labels{/name}","comments_url":"https://api.github.com/repos/postcss/postcss/issues/754/comments","events_url":"https://api.github.com/repos/postcss/postcss/issues/754/events","html_url":"https://github.com/postcss/postcss/issues/754","id":138467199,"number":754,"title":"Integrate value & selector parsing into PostCSS core.","user":{"login":"ben-eb","id":1282980,"avatar_url":"https://avatars.githubusercontent.com/u/1282980?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-eb","html_url":"https://github.com/ben-eb","followers_url":"https://api.github.com/users/ben-eb/followers","following_url":"https://api.github.com/users/ben-eb/following{/other_user}","gists_url":"https://api.github.com/users/ben-eb/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-eb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-eb/subscriptions","organizations_url":"https://api.github.com/users/ben-eb/orgs","repos_url":"https://api.github.com/users/ben-eb/repos","events_url":"https://api.github.com/users/ben-eb/events{/privacy}","received_events_url":"https://api.github.com/users/ben-eb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/postcss/postcss/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/postcss/postcss/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/postcss/postcss/milestones/2","html_url":"https://github.com/postcss/postcss/milestones/6.0","labels_url":"https://api.github.com/repos/postcss/postcss/milestones/2/labels","id":1597762,"number":2,"title":"6.0","description":"","creator":{"login":"ai","id":19343,"avatar_url":"https://avatars.githubusercontent.com/u/19343?v=3","gravatar_id":"","url":"https://api.github.com/users/ai","html_url":"https://github.com/ai","followers_url":"https://api.github.com/users/ai/followers","following_url":"https://api.github.com/users/ai/following{/other_user}","gists_url":"https://api.github.com/users/ai/gists{/gist_id}","starred_url":"https://api.github.com/users/ai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ai/subscriptions","organizations_url":"https://api.github.com/users/ai/orgs","repos_url":"https://api.github.com/users/ai/repos","events_url":"https://api.github.com/users/ai/events{/privacy}","received_events_url":"https://api.github.com/users/ai/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":1,"state":"open","created_at":"2016-02-22T18:06:28Z","updated_at":"2016-03-13T09:07:09Z","due_on":null,"closed_at":null},"comments":20,"created_at":"2016-03-04T12:46:29Z","updated_at":"2016-03-16T15:49:20Z","closed_at":null,"body":"So, one of my main concerns about writing cssnano version 4 is that I am trying to glue together lots of different parsers, each with different APIs, and I find myself wanting a much richer AST than what PostCSS currently provides. I feel that as per @thejameskyle's suggestion, we should look at parsing selectors and values;\r\n\r\n>  I'm not sure if PostCSS wants to dive into creating an AST for all CSS values, as that adds a ton of complexity to what is currently extremely simple. Although, most modern compiler authors would [think that] this is the most sustainable solution.\r\n\r\nhttps://github.com/thejameskyle/postcss-function-resolution\r\n\r\nThis means that we need to extend `Declaration` and `Rule` to provide a more detailed AST. I don't exactly know how this should look yet, so any suggestions are welcome. But James' rough draft looks good;\r\n\r\n```js\r\n{\r\n  type: Declaration,\r\n  value: {\r\n    type: Expression,\r\n    expression: {\r\n      type: CallExpression,\r\n      callee: {\r\n        type: Identifier,\r\n        name: 'foo'\r\n      },\r\n      arguments: [{\r\n        type: CallExpression,\r\n        callee:{\r\n          type: Identifier,\r\n          name: 'bar'\r\n        },\r\n        arguments: [{\r\n          ...\r\n        }]\r\n      }]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nFurthermore, I'd like to drop `node.raws.value.value` and `node.raws.value.raw` from the AST completely and force plugin authors to provide support for comments or not in their plugins; the current behaviour is that PostCSS will hide comments automatically, which can cause problems with things like [userstyles](https://userstyles.org/help/coding). This would be much easier when we have a unified AST that covers values and selectors as plugin authors can just ignore comments, and instead operate on relevant values.\r\n\r\nI am concerned that this is a big change and is not something that I will consider lightly, so I'm looking for feedback. It makes writing complex plugins like cssnano & stylelint easier at the expense of smaller plugins, but I feel like this allows us to do some really sophisticated transforms/analysis in the future.\r\n\r\n***\r\n\r\nThis issue supercedes https://github.com/postcss/postcss/issues/410, https://github.com/postcss/postcss/issues/235 & https://github.com/postcss/postcss/issues/178."},"comment":{"url":"https://api.github.com/repos/postcss/postcss/issues/comments/197391916","html_url":"https://github.com/postcss/postcss/issues/754#issuecomment-197391916","issue_url":"https://api.github.com/repos/postcss/postcss/issues/754","id":197391916,"user":{"login":"ben-eb","id":1282980,"avatar_url":"https://avatars.githubusercontent.com/u/1282980?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-eb","html_url":"https://github.com/ben-eb","followers_url":"https://api.github.com/users/ben-eb/followers","following_url":"https://api.github.com/users/ben-eb/following{/other_user}","gists_url":"https://api.github.com/users/ben-eb/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-eb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-eb/subscriptions","organizations_url":"https://api.github.com/users/ben-eb/orgs","repos_url":"https://api.github.com/users/ben-eb/repos","events_url":"https://api.github.com/users/ben-eb/events{/privacy}","received_events_url":"https://api.github.com/users/ben-eb/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T15:49:20Z","updated_at":"2016-03-16T15:49:20Z","body":"I think *we must* parse each and every node. Currently *we don't* do this, which is what I find to be brittle and means that plugins must be run in an exact order; this is not a good developer experience."}}