-
Notifications
You must be signed in to change notification settings - Fork 385
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
Add runtime CSS minification, !important replacement, and tree shaking #1048
Merged
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
48a538b
Add sabberworm/php-css-parser composer dependency
westonruter 0e994a9
Add initial Server Timing response headers
westonruter 8271fac
Use sabberworm/php-css-parser to sanitize CSS
westonruter a96b39b
Delete illegal properties (behavior and -moz-binding)
westonruter 06fca39
Include sabberworm/php-css-parser from composer in build; always comp…
westonruter c27e9a2
Add check for composer install; update contributing with dev installa…
westonruter 8ef82f7
Add tests for AMP_Response_Headers
westonruter e16aba2
Add missing phpdoc for functions in amp.php
westonruter 036c631
Improve handling of style[amp-keyframes] by merging multiples and ens…
westonruter fd04b20
Transform !important property qualifiers into rules with more specifi…
westonruter 5da10f3
Remove illegal @-rules and ensure properties inside @media/@supports …
westonruter 523d5ee
Include css_spec from validator in AMP_Allowed_Tags_Generated
westonruter 1889f70
Capture full cdata spec for amp-keyframes and amp-custom to use for v…
westonruter 9187710
Discontinue deleting scroll/auto values for overflow properties since…
westonruter 3d18b8a
Add parsing and validation of keyframes
westonruter f245a8f
Ensure stylesheets are output in legacy post templates
westonruter 6c49807
Bump required PHP to 5.3.2 for sake of php-css-parser
westonruter 3e3266b
Add class-based selector tree shaking of CSS rules
westonruter 6b5f97e
Further reduce CSS size by deleting individual selectors that lack va…
westonruter ae68eee
Prevent :not() pseudo-selectors from tree shaking classes erroneously
westonruter 6d4778e
Remove attribute selectors prior to searching for class names to prev…
westonruter 2693f7e
Simplify accounting for used class names when tree shaking
westonruter faef934
Make font-face source urls non-relative; replace data: URLs with (ass…
westonruter cb3cc2c
Use expiring transients when no external object cache present
westonruter 346eae2
Handle selector specificity variability; give high specificity to rul…
westonruter 14c22c2
Convert all URLs (including background-image) to have absolute paths
westonruter 313f0b9
Merge branch 'develop' of https://github.com/Automattic/amp-wp into a…
westonruter bede9de
Prevent filtering selectors which reference dynamic elements
westonruter adb1fb1
Skip removing style rules when the total CSS does not exceed max_bytes
westonruter a8fddf2
Verify existence of font file source for data: URL
westonruter 3cd9fdd
Add tests for validation errors raised during style sanitization
westonruter efd1965
Add testing for remove_unused_rules=sometimes and excessive_css
westonruter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,22 @@ | |
|
||
Thanks for taking the time to contribute! | ||
|
||
To clone this repository | ||
``` bash | ||
$ git clone --recursive [email protected]:Automattic/amp-wp.git | ||
To start, clone this repository into your WordPress install being used for development: | ||
|
||
```bash | ||
cd wp-content/plugins && git clone --recursive [email protected]:Automattic/amp-wp.git amp | ||
``` | ||
|
||
If you happened to have cloned without `--recursive` previously, please do `git submodule update --init` to ensure the [dev-lib](https://github.com/xwp/wp-dev-lib/) submodule is available for development. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good idea to add this. |
||
|
||
Lastly, to get the plugin running in your WordPress install, run `composer install` and then activate the plugin via the WordPress dashboard or `wp plugin activate amp`. | ||
|
||
To install the `pre-commit` hook, do `bash dev-lib/install-pre-commit-hook.sh`. | ||
|
||
Note that pull requests will be checked against [WordPress-Coding-Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) with PHPCS, and for JavaScript linting is done with ESLint and (for now) JSCS and JSHint. | ||
|
||
To run the Grunt commands, please first `npm install -g grunt-cli` and then `npm install`. | ||
|
||
## Updating Allowed Tags And Attributes | ||
|
||
The file `class-amp-allowed-tags-generated.php` has the AMP specification's allowed tags and attributes. It's used in sanitization. | ||
|
@@ -72,6 +83,7 @@ When you push a commit to your PR, Travis CI will run the PHPUnit tests and snif | |
|
||
Contributors who want to make a new release, follow these steps: | ||
|
||
0. Do `grunt build` and install the `amp.zip` onto a normal WordPress install running a stable release build; do smoke test to ensure it works. | ||
1. Bump plugin versions in `package.json` (×1), `package-lock.json` (×1, just do `npm install` first), `composer.json` (×1), and in `amp.php` (×2: the metadata block in the header and also the `AMP__VERSION` constant). | ||
2. Add changelog entry to readme. | ||
3. Merge release branch into `master`. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvements here with the DocBlocks and
@since
tags.