All Projects → bezoerb → Grunt Critical

bezoerb / Grunt Critical

Licence: other
Grunt task to extract & inline critical-path CSS from HTML

Labels

Projects that are alternatives of or similar to Grunt Critical

Time Grunt
Display the elapsed execution time of grunt tasks
Stars: ✭ 531 (+284.78%)
Mutual labels:  grunt
Grunt Javascript Obfuscator
Obfuscates JavaScript files using amazing javascript-obfuscator.
Stars: ✭ 34 (-75.36%)
Mutual labels:  grunt
Grunt Menu
Useful menu interface for listing/executing your configured tasks
Stars: ✭ 79 (-42.75%)
Mutual labels:  grunt
Instantbootstrap
Instant Bootstrap is a quick and easy way to start creating bootstrap themes using LESS, SASS, GRUNT, and BOWER.
Stars: ✭ 5 (-96.38%)
Mutual labels:  grunt
Hive Framework
A website development framework built with Sass, and incorporating jQuery UI.
Stars: ✭ 14 (-89.86%)
Mutual labels:  grunt
Mathjax Grunt Cleaner
A grunt file to reduce the footprint of a MathJax installation
Stars: ✭ 42 (-69.57%)
Mutual labels:  grunt
Lein template descjop
A Leiningen template(Clojure/ClojureScript Project) for Web based desktop application with Electron (atom-shell).
Stars: ✭ 394 (+185.51%)
Mutual labels:  grunt
Tacit
CSS Framework for Dummies, Without Classes
Stars: ✭ 1,344 (+873.91%)
Mutual labels:  grunt
Docker Compose Nodejs Examples
Finally some real world examples on getting started with Docker Compose and Nodejs
Stars: ✭ 944 (+584.06%)
Mutual labels:  grunt
Grunt2gulp.js
Converts Grunt task files, gruntfile.js, to Gulp files.
Stars: ✭ 64 (-53.62%)
Mutual labels:  grunt
Opml2indesign
The XSLT which convert an OPML file to InDesign importable XML
Stars: ✭ 6 (-95.65%)
Mutual labels:  grunt
Grunt Csswring
DEPRECATED. Minify CSS files using PostCSS-based CSSWring
Stars: ✭ 12 (-91.3%)
Mutual labels:  grunt
Grunt Frontend Workflow
Structured, modular and test-driven front-end development and build workflow with Grunt task runner. Includes boilerplate code for Backbone with single/multipage RequireJS setup, and a RESTful API for prototyping.
Stars: ✭ 44 (-68.12%)
Mutual labels:  grunt
Grunt Responsive Images
Produce images at different sizes for responsive websites.
Stars: ✭ 726 (+426.09%)
Mutual labels:  grunt
Grunt Parallelize
Make your task parallel.
Stars: ✭ 81 (-41.3%)
Mutual labels:  grunt
Assemble
Community
Stars: ✭ 3,995 (+2794.93%)
Mutual labels:  grunt
Grunt Md2html
Small Grunt MultiTask to convert Markdown files to HTML, supporting Grunt >= 1.0.0
Stars: ✭ 37 (-73.19%)
Mutual labels:  grunt
Grunt Drupal Tasks
Grunt-based build and testing tasks for Drupal
Stars: ✭ 125 (-9.42%)
Mutual labels:  grunt
Guides
A miscellania of how-to's, references, and style guides for stuff I'm into.
Stars: ✭ 82 (-40.58%)
Mutual labels:  grunt
Phplint
Lightning fast concurrent PHP linter for Node.js, Grunt & Gulp! ⚡️
Stars: ✭ 62 (-55.07%)
Mutual labels:  grunt

grunt-critical

Grunt plugin to extract & inline critical-path CSS from HTML

NPM version Build Status Dependency Status

Getting Started

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-critical --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-critical');

Critical task

Run this task with the grunt critical command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Generate critical path css and inline it with critical.

Usage

Use the grunt-critical task by specifying a target destination (file) for your critical CSS. Below this is test/generated/critical.css.

Along-side, specify the input HTML file you would like scanned as well as the width and height of the critical viewport. In this case test/fixture/index.html.

critical: {
    test: {
        options: {
            base: './',
            css: [
                'test/fixture/styles/main.css',
                'test/fixture/styles/bootstrap.css'
            ],
            width: 320,
            height: 70
        },
        src: 'test/fixture/index.html',
        dest: 'test/generated/critical.css'
    }
}

If the dest file is a stylesheet, the resulting critical-path css is saved to this file for later use. If dest points to an Markup file (HTML, PHP, etc.) the resulting CSS gets inlined and the exiting stylesheets are wrapped in a javascript function to load them asynchronously as well as a noscript block for users with JavaScript disabled

critical: {
    test: {
        options: {
            base: './',
            css: [
                'test/fixture/styles/main.css',
                'test/fixture/styles/bootstrap.css'
            ],
            width: 320,
            height: 70
        },
        src: 'test/fixture/index.html',
        dest: 'test/generated/index-critical.html'
    }
}

Options

For a full list of options see critical

License

(C) Ben Zörb 2014, released under an MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].