grunt-images2css

0.1.1 • Public • Published

grunt-images2css

images2css plugin

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-images2css --save-dev

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

grunt.loadNpmTasks('grunt-images2css');

The "images2css" task

Overview

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

grunt.initConfig({
  images2css: {
      imgTask: {
        options: {
            folderPath: 'src/img',
            imageRelativePath: '',
            backgroundSize: true
        },
        dest: 'src/img/images2css.css'
      },
      sliceTask: {
          options: {
              folderPath: 'src/slice',
              imageRelativePath: '',
              backgroundSize: true
          },
          dest: 'src/slice/images2css.css'
      }
    },
});

Options

options.folderPath

Type: String Default value: './'

图片所在目录

options.imageRelativePath

Type: String Default value: './'

图片相对路径

Usage Examples

It's so easy, so no examples.

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

  • 2015-02-05   v0.1.1   重新调整结构

Readme

Keywords

Package Sidebar

Install

npm i grunt-images2css

Weekly Downloads

1

Version

0.1.1

License

none

Last publish

Collaborators

  • littledu