Generate critical css for your web pages
MIT License
Bot releases are visible (Hide)
Published by pocketjoso over 6 years ago
ForceInclude not only *
(and body
, html
) but now also *:before
and *:after
, as they are quite common, and always "present" on the page. This avoids querying the DOM to test if these selectors are in the critical viewport, which will bring a (very small) speed improvement.
Published by pocketjoso over 6 years ago
#265 has the details.
Published by pocketjoso over 6 years ago
Published by pocketjoso over 6 years ago
Published by pocketjoso over 6 years ago
#261 - Take latest version of Puppeteer.
#260 - bugfix for createBrowser option
Published by pocketjoso over 6 years ago
Published by pocketjoso over 6 years ago
#244 - Upgrade to puppeteer 1.0.0. Still not the latest version, as chromium seems to have regressed regarding the file protocol issue..
#224, #229, #240 - Do more execution in parallel instead of synchronously in sequence. In theory this should be faster, but in practice page load time (and sceenshots, if used) are big bottlenecks, so in the end performance after this changes is more or less the same, for now.
#241 - Readme update: separate simple usage examples and exhaustive options list (now in a table). Also added a separate examples folder to demonstrate how to do perform common tasks: take screenshots, use custom puppeteer browser, launch many jobs (with good performance).
#228 - Some error handling improvements, credit to @hummal
See all changes:
https://github.com/pocketjoso/penthouse/compare/v.1.4.0...v.1.4.1
Published by pocketjoso over 6 years ago
#222 - refactoring of css-tree usage ended up bringing roughly a 65% performance improvement over the previous version. π
The test suite was also updated in this release, now using Jest.
Published by pocketjoso almost 7 years ago
Removed last piece of code using non fault tolerant css (ast parser), which was used for property removal (via apartment dependency).
Made full postformatting process work on ast format, and fix issue of converting back and forth between ast and css string.
Published by pocketjoso almost 7 years ago
yarn add penthouse
/ npm install penthouse
(@1.2.0
)
swaps CSS ast parser to css-tree which is fault tolerant:
https://github.com/pocketjoso/penthouse/pull/209
The critical css generation will now work work regardless of any errors in the original css. If a browser can understand it, Penthouse will. No more incorrect critical css files due to missed semi colons or closing braces!
With this change penthouse never has to run it's own normalisation step for the original css, which was both slow and led to some unwanted side effects.
the propertiesToRemove
is temporarily in a try/catch
statement now, as it will fail if the critical css contains (i.e. preserves) errors from the original css, since this part of Penthouse is not fault tolerant yet. This just means that those properties will remain. On average this seems to add about 0.5% weight to generated critical css files, and this will be fixed in an upcoming release.
https://github.com/pocketjoso/penthouse/issues/201
https://github.com/pocketjoso/penthouse/issues/194
https://github.com/pocketjoso/penthouse/issues/105
https://github.com/pocketjoso/penthouse/issues/104
Published by pocketjoso almost 7 years ago
Published by pocketjoso almost 7 years ago
Fixes timeout issues for some sites.
Since switching to Chrome headless via puppeteer some websites started timing out, sites that were working previously with PhantomJS. I debugged it and via https://github.com/GoogleChrome/puppeteer/issues/662 realised it's because these sites continuously fire requests (f.e. for tracking) in such a way that the load
event never fires.
Here the solution is a new pageLoadSkipTimeout
option, that can be set to skip the load
waiting after a certain time, and continue onwards with the critical css generation.
For most use cases this option should not be needed, as the regular load
even should fire in time.
Published by pocketjoso about 7 years ago
Published by pocketjoso about 7 years ago
Published by pocketjoso about 7 years ago
Most important was 9b83c97f4233c6b2158dad6e3eb7e8ee39a715c4 which resolves a memory leak via chrome pages that were never closed in some circumstances.
Published by pocketjoso about 7 years ago
Published by pocketjoso about 7 years ago
Release post:
https://medium.com/@pocketjoso/penthouse-1-0-official-release-ece995b0d29e
TLDR:
screenshots
option for before/after imagesSee #174 for details.
Published by pocketjoso about 7 years ago
Published by pocketjoso about 7 years ago
Published by pocketjoso about 7 years ago
config.json
file in lib
folder on installcss
fork via yarnapartment
invocation in cases when critical css has (maintained) errors.lib
folder to git