{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/amp-wp/issues/1048","repository_url":"https://api.github.com/repos/Automattic/amp-wp","labels_url":"https://api.github.com/repos/Automattic/amp-wp/issues/1048/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/amp-wp/issues/1048/comments","events_url":"https://api.github.com/repos/Automattic/amp-wp/issues/1048/events","html_url":"https://github.com/Automattic/amp-wp/pull/1048","id":309995145,"number":1048,"title":"Add runtime CSS minification, !important replacement, and tree shaking","user":{"login":"westonruter","id":134745,"avatar_url":"https://avatars2.githubusercontent.com/u/134745?v=4","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"westonruter","id":134745,"avatar_url":"https://avatars2.githubusercontent.com/u/134745?v=4","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false},"assignees":[{"login":"westonruter","id":134745,"avatar_url":"https://avatars2.githubusercontent.com/u/134745?v=4","gravatar_id":"","url":"https://api.github.com/users/westonruter","html_url":"https://github.com/westonruter","followers_url":"https://api.github.com/users/westonruter/followers","following_url":"https://api.github.com/users/westonruter/following{/other_user}","gists_url":"https://api.github.com/users/westonruter/gists{/gist_id}","starred_url":"https://api.github.com/users/westonruter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westonruter/subscriptions","organizations_url":"https://api.github.com/users/westonruter/orgs","repos_url":"https://api.github.com/users/westonruter/repos","events_url":"https://api.github.com/users/westonruter/events{/privacy}","received_events_url":"https://api.github.com/users/westonruter/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Automattic/amp-wp/milestones/7","html_url":"https://github.com/Automattic/amp-wp/milestone/7","labels_url":"https://api.github.com/repos/Automattic/amp-wp/milestones/7/labels","id":3171161,"number":7,"title":"v1.0","description":"","creator":{"login":"ThierryA","id":3581402,"avatar_url":"https://avatars3.githubusercontent.com/u/3581402?v=4","gravatar_id":"","url":"https://api.github.com/users/ThierryA","html_url":"https://github.com/ThierryA","followers_url":"https://api.github.com/users/ThierryA/followers","following_url":"https://api.github.com/users/ThierryA/following{/other_user}","gists_url":"https://api.github.com/users/ThierryA/gists{/gist_id}","starred_url":"https://api.github.com/users/ThierryA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThierryA/subscriptions","organizations_url":"https://api.github.com/users/ThierryA/orgs","repos_url":"https://api.github.com/users/ThierryA/repos","events_url":"https://api.github.com/users/ThierryA/events{/privacy}","received_events_url":"https://api.github.com/users/ThierryA/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":8,"state":"open","created_at":"2018-03-08T09:34:26Z","updated_at":"2018-03-30T20:46:38Z","due_on":"2018-05-04T07:00:00Z","closed_at":null},"comments":2,"created_at":"2018-03-30T07:18:13Z","updated_at":"2018-04-02T16:52:15Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/Automattic/amp-wp/pulls/1048","html_url":"https://github.com/Automattic/amp-wp/pull/1048","diff_url":"https://github.com/Automattic/amp-wp/pull/1048.diff","patch_url":"https://github.com/Automattic/amp-wp/pull/1048.patch"},"body":"- [x] Add support for [Server Timing](https://w3c.github.io/server-timing/) to reveal the time required for the plugin to render a response. Move header-sending logic to `AMP_Response_Headers` class. See #990.\r\n- [x] Minify CSS to remove whitespace and comments. See #688.\r\n- [x] Sanitize CSS by means of a CSS parser instead of relying on regular expressions.\r\n- [x] Remove illegal CSS properties (`-moz-binding` and `behavior`).\r\n- [x] Reduce length of CSS class names generated for `style` attributes.\r\n- [x] If `amp-keyframes` appears anywhere but end of `body`, just move it to the end of the `body`.\r\n- [x] Implement the [replace-important](https://www.npmjs.com/package/replace-important) approach to eliminating `!important` qualifiers.\r\n- [x] Delete illegal CSS @-rules.\r\n- [x] Make sure css_spec gets parsed and included in AMP_Allowed_Tags_Generated.\r\n- [x] Limit `@keyframes` to opacity, transform and -vendorPrefix-transform. \r\n- [x] Make sure legacy post template still renders properly with stylesheet changes.\r\n- [x] Delete CSS rules that don't apply to the current page based on the class names used. (CSS tree shaking.)\r\n- [x] Delete selectors that reference class names that don't exist.\r\n- [x] Handle case of false negatives when a selector contains `:not(.classname)`. Also strip strings.\r\n- [x] Figure out how to gracefully deal with Genericons and Dashicons.\r\n- [x] Use expiring transient instead of indefinite cache when external cache is not available.\r\n- [x] Improve handling of specificity, including giving higher selector specificity to rules from inline styles. Reduce length of fake ID.\r\n- [x] Address relative URLs, such as for background images.\r\n\r\nFixes #990.\r\nFixes #930.\r\nFixes #688.\r\nCloses #610.\r\n\r\nIdeas for later:\r\n* Look at other tree-shaking methods beyond class names.\r\n* Add tree-shaking based on IDs."},"comment":{"url":"https://api.github.com/repos/Automattic/amp-wp/issues/comments/377976293","html_url":"https://github.com/Automattic/amp-wp/pull/1048#issuecomment-377976293","issue_url":"https://api.github.com/repos/Automattic/amp-wp/issues/1048","id":377976293,"user":{"login":"pbakaus","id":43004,"avatar_url":"https://avatars1.githubusercontent.com/u/43004?v=4","gravatar_id":"","url":"https://api.github.com/users/pbakaus","html_url":"https://github.com/pbakaus","followers_url":"https://api.github.com/users/pbakaus/followers","following_url":"https://api.github.com/users/pbakaus/following{/other_user}","gists_url":"https://api.github.com/users/pbakaus/gists{/gist_id}","starred_url":"https://api.github.com/users/pbakaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbakaus/subscriptions","organizations_url":"https://api.github.com/users/pbakaus/orgs","repos_url":"https://api.github.com/users/pbakaus/repos","events_url":"https://api.github.com/users/pbakaus/events{/privacy}","received_events_url":"https://api.github.com/users/pbakaus/received_events","type":"User","site_admin":false},"created_at":"2018-04-02T16:52:15Z","updated_at":"2018-04-02T16:52:15Z","author_association":"COLLABORATOR","body":"My $0.02: We should be extra careful to not strip out stuff that could break things on the page, without a proper way to flag and notify the webmaster. So essentially, we have a bunch of categories of optimizations:\r\n\r\n1. Minification (generally safe)\r\n2. Substitution (Also generally safe, e.g. the `!important` trick)\r\n3. Filtering (Not safe)\r\n\r\nIf filtering is required to make something AMP valid, it's probably better to either:\r\n\r\n1. Not filter, and throw warning that AMP is invalid because of these things\r\n2. Filter, but throw strong visual warnings on the theme page / wp-admin\r\n\r\nI'm in the former camp, but either way probably works."}}
{"actor":{"display_login":"pbakaus"}}