0.1.1 • Published 8 years ago

grunt-more-css v0.1.1

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

grunt-more-css v0.1.1 Build Status

Minify CSS using more-css.

More-css currently dominates minification benchmarks (results). This plugin makes it available for Grunt users.

Getting Started

This plugin requires Grunt >=0.4

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-more-css --save-dev

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

grunt.loadNpmTasks('grunt-more-css');

The "more_css" task

Overview

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

grunt.initConfig({
  more_css: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Options

radical

Type: Boolean Default value: true

A boolean value indicating whether "radical compression" is enabled. See more-css documentation and Caveats (below).

report

Choices: 'min', 'gzip' Default: 'min'

Either report only minification result or report minification and gzip results. This is useful to see exactly how well clean-css is performing but using 'gzip' will make the task take 5-10x longer to complete. Example output.

Usage Examples

Default Options

In this example, src/style1.css and src/style2.css are minified to a single file called dest/style.min.css.

grunt.initConfig({
  more_css: {
    my_target: {
      files: {
        'dest/style.min.css': ['src/style1.css', 'src/style2.css'],
      },
    },
  },
});

Custom Options

In this example, radical compression is disabled and both minified and min+gzipped size is reported.

grunt.initConfig({
  more_css: {
    options: {
      radical: false,
      report: 'gzip',
    },
    my_target: {
      files: {
        'dest/style.min.css': ['src/style1.css', 'src/style2.css'],
      },
    },
  },
});

Caveats

The author doesn't understand the more-css documentation. The "radical compression" option is probably dangerous and will break your CSS in some corner cases.

To get a rough idea what the compression tricks might be, see this blog post by Colt McAnlis.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2016-02-25 v0.1.1 updated dependencies (support for Grunt 1.0)
  • 2015-02-13 v0.1.0 initial release
0.1.1

8 years ago

0.1.0

9 years ago