🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

postcss-images-to-css

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-images-to-css

PostCSS plugin to generate

0.0.2
latest
Source
npm
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-images-to-css

Postcss plugin to create css file with rules for icons from files in a folder

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 postcss-images-to-css- --save-dev

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

Grunt PostCSS


grunt.initConfig({
  postcss: {
    options: {
      processors: [
        require('postcss-sprites-css')({
			spriteDir: '/public/images/sprite',
			outputFile: '/public/css/sprites.css'
		})
      ]
    },
    dist: { src: 'build/*.css' }
  },
});

Usage

You have some images in the spriteDir an in file /public/css/sprites.css will generate:

.icon, [class^="icon-"], [class*=" icon-"] {
	display: -moz-inline-stack;
	display: inline-block;
	vertical-align: middle;
	*vertical-align: auto;
	zoom: 1;
	*display: inline;
}
.icon-alert-dialog-modal{
	background-image: resolve("alert-dialog-modal.png");
	width:17px;
	height:26px;
	 margin: 0 3px;
}

Options

spriteDir:

Type: String
Default: '/public/images/sprite'

Set the folder where your images are placed

outputFile

Type: String
Default: '/public/css/sprites.css'

Set the file where css rules will be written.

Contributing / Issues

You may want to contribute to this project, pull requests are welcome if you accept to publish under the MIT licence.

Keywords

postcss

FAQs

Package last updated on 07 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts