0.1.0 • Published 10 years ago

grunt-contrib-gotohead v0.1.0

Weekly downloads
1
License
-
Repository
github
Last release
10 years ago

grunt-contrib-gotohead

Put into the HEAD of a HTML document snippets of code CSS or Javascript.

If you care about your website performance, you surely care about CSS and JavaScript minification, probably image optimization too, but what about the rendering of all this, do you care? This Grunt plugin was made to help you with that.

When we separate the code of the visible content from the other it's possible to optimize the speed of rendering of the page, obtaining a gain in the overall performance.

Getting Started

This plugin requires Grunt ~0.4.5

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-contrib-gotohead --save-dev

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

grunt.loadNpmTasks('gotohead');

The "gotohead" task

Overview

In your project's Gruntfile, add a section named gotohead to the data object passed into grunt.initConfig().

grunt.initConfig({
  gotohead: {
    my_task: {
      options: {
        jade: false,
        tag: 'style'
      },
      files: [
        { orig: 'path/to/original/html.html',
          dest: 'path/to/updated/html.html',
          src: [ 'public/css/style1.css', 'public/css/style2.css' ] }
      ]
    }
  }
});

You don't need minify your code because it will be done automatically.

Options

Jade

Type: boolean Default value: false

Used to update your HTML template wrote with Jade Template Engine.

Tag

Type: string

ValueDescription
styleDefault value. For css code.
scriptFor Javascript code.
1.1.5

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.1.0

10 years ago