postcss-short-data
Write shorthand data attribute selectors in CSS
Last updated 10 years ago by jonathantneal .
CC0-1.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install postcss-short-data 
SYNC missed versions from official npm registry.

Shorthand Data

NPM Version Build Status

Shorthand Data lets you write shorthand data attribute selectors in CSS.

/* before */

nav a[:active] {
	background: #f3f3f3;
}

button[:target~="main"] {
	background: #334332;
}

/* after */

nav a[data-active] {
	background: #f3f3f3;
}

button[data-target~="main"] {
	background: #334332;
}

Usage

Add Shorthand Data to your build tool:

npm install postcss-short-data --save-dev

Node

require('postcss-short-data').process(YOUR_CSS, { /* options */ });

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load Shorthand Data as a PostCSS plugin:

postcss([
	require('postcss-short-data')({ /* options */ })
]);

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Enable Shorthand Data within your Gulpfile:

var postcss = require('gulp-postcss');

gulp.task('css', function () {
	return gulp.src('./css/src/*.css').pipe(
		postcss([
			require('postcss-short-data')({ /* options */ })
		])
	).pipe(
		gulp.dest('./css')
	);
});

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Enable Shorthand Data within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
	postcss: {
		options: {
			processors: [
				require('postcss-short-data')({ /* options */ })
			]
		},
		dist: {
			src: 'css/*.css'
		}
	}
});

Current Tags

  • 1.1.0                                ...           latest (10 years ago)

2 Versions

  • 1.1.0                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |