Skip to content

Releases: addyosmani/critical

Critical 0.7.0

22 Dec 11:39
Compare
Choose a tag to compare

What is critical?

"Critical" resources are any of those that can block initial rendering of your web page and the fewer of those there are, the less work the browser has to do to get content on the screen. Optimising the critical rendering path involves prioritising the display of content on your web page that relates to the current user action. So, stuff they can actually see. critical (this project) extracts & inlines critical-path (above-the-fold) CSS from HTML.

Release highlights for 0.7.0

  • Now uses the latest versions of Penthouse and inline-critical under the hood
  • Remote resources are now supported when generating critical CSS for a page
  • Enabled inlining of external images by dropping imageInliner in favor of postcss-image-inliner
  • Windows: switched to local HTTP server when serving files over http to improve stability
  • Adds URL support for filetypes other than HTML.
  • Fix actually emitting Critical's errors in stream
  • Infra: Improve tests, test output cleanup, adjustments to adhere to Penthouse updates, fixed up AppVeyor tests

A full list of changes between 0.6.0 and 0.7.0 is available.

As always, a huge thank you to @bezoerb for all his wonderful help maintaining this module as well as grunt-critical.

Community highlights

📖 Dean Hume's excellent Smashing Magazine post on understanding and optimising critical path CSS using critical and grunt-critical is worth checking out

📹 Totally Tooling Tips: Critical Path CSS is a quick video walkthrough of critical path CSS and tools with Matt Gaunt and I

📝 FourKitchens also have a short write-up on how they're using critical with Gulp for their build process.

Works great with static-site generators

I've noticed a few folks using critical with Jekyll and other static site generators. Getting this setup for your index/landing-page is pretty straight-forward and looks a little like this if using Gulp:

gulp.task('critical-css', function() {
    critical.generate({
        // Base directory
        base: '_site/',
        // HTML source file
        src: 'index.html',
        // CSS output file
        dest: 'css/critical.min.css',
        // Viewport width
        width: 1280,
        // Viewport height
        height: 900,
        // Minify critical-path CSS
        minify: true
    });
});

This is the type of task I run once all of the others in my Gulp/Jekyll build process (such as Sass compilation) are fully completed. Here's PageSpeed Insights verifying the setup works on my site:

jekyll

To see a real-world Jekyll + Gulp setup using this for multi-resolution CSS, check-out the FourKitchen's gulpfile.js.

Alternatives

A comprehensive list of tools in the critical path CSS ecosystem is also maintained by this project in case you're interested in trying out alternatives. We just want you to get fast and stay fast 💌

0.6.0

07 Jul 14:52
Compare
Choose a tag to compare

This release brings some great changes to the Critical API to make it more stable and easy to use.

New Features

  • Introduced a new stream method which lets you integrate critical lot a lot easier with gulp
  • Unified options across stream cli and module
  • Added new options to customize critical for your production needs
    • pathPrefix Path to prepend CSS assets with
    • ignore Ignore CSS selectors
  • The Node.js module now returns a promise when no callback is provided

Deprecation notice (0.6.x)

Command-line interface (CLI)
  • The option htmlTarget has been deprecated and will be removed in 1.0.0
  • The option styleTarget has been deprecated and will be removed in 1.0.0

Use the inline flag to inline the critical CSS to your HTML markup

Node.js module
  • The method generateInline has been deprecated and will be removed in 1.0.0
  • The method inline has been deprecated and will be removed in 1.0.0
  • The option htmlTarget has been deprecated and will be removed in 1.0.0
  • The option styleTarget has been deprecated and will be removed in 1.0.0

Use the generate method along with the inline option to inline your critical-path CSS directly.

Commits

0.5.7

12 Apr 17:07
Compare
Choose a tag to compare

0.5.6

16 Mar 14:10
Compare
Choose a tag to compare

Just a quick bug fix release.

v0.5.5...v0.5.6

0.5.5 - angelic expedient

03 Mar 22:18
Compare
Choose a tag to compare

This release of Critical adds new support for multi-dimensional critical CSS. When your site is adaptive and you want to deliver critical CSS for multiple screen resolutions this is a useful option. We also now support increased default dimensions for our generated CSS, moving towards a more practical set of default configuration.

Along with these additions, we've also improved our overall unit testing story and including several bug fixes that improve overall stability of the project.

Big thanks go out to @bezoerb @pocketjoso @sindresorhus @samccone for their help with this release.

0.5.4

09 Feb 13:57
Compare
Choose a tag to compare

Put temp files in the system temp folder instead of the current one. 849ce3b

v0.5.3...v0.5.4

0.5.3

17 Jan 16:35
Compare
Choose a tag to compare

Bumped penthouse.

0.5.2

11 Jan 23:53
Compare
Choose a tag to compare

Locked penthouse version as it was breaking critical. #56

critical 0.5.1 legendary-velvet

28 Dec 15:53
Compare
Choose a tag to compare

This is a minor maintenance release. Changelog:

v0.5.0 speedy-whistle

28 Nov 13:27
Compare
Choose a tag to compare

This new release of Critical includes support for a CLI, better stability on Windows and a number of other bug fixes and minor enhancements.

CLI preview:

  • f436967 Inline critical version bump
  • 4860f07 Increased mocha timeout
  • c343133 Fixed newline character in css to address #14
  • a6e1882 Updated version of inline-critical to address #14
  • dc2abf9 Added bin/critical to files #49
  • 38e55bd added cli / changed structure
  • 6f97f8a Remove inlined CSS rules from source stylesheets #39
  • a93bcb4 Fixed backslash in rebased paths on windows
  • f95d2fc fixed fa77c44
  • fa77c44 Return critical css even if unlinking of the temporary file fails
  • 57da65c Ignores external stylesheets

~ Brought to you by @bezoerb and @addyosmani