{"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"},{"name":"moox","email":"m@moox.io"}],"keywords":["postcss","postcss-plugin","css","selector","custom-selector"],"dist-tags":{"latest":"3.0.0"},"description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","readme":"# PostCSS Custom Selectors\n\n[![Build Status](https://travis-ci.org/postcss/postcss-custom-selectors.svg?branch=master)](https://travis-ci.org/postcss/postcss-custom-selectors)\n[![NPM Downloads](https://img.shields.io/npm/dm/postcss-custom-selectors.svg?style=flat)](https://www.npmjs.com/package/postcss-custom-selectors)\n[![NPM Version](http://img.shields.io/npm/v/postcss-custom-selectors.svg?style=flat)](https://www.npmjs.com/package/postcss-custom-selectors)\n[![License](https://img.shields.io/npm/l/postcss-custom-selectors.svg?style=flat)](http://opensource.org/licenses/MIT)\n\n> [PostCSS](https://github.com/postcss/postcss) plugin to transform  [W3C CSS Extensions(Custom Selectors)](http://dev.w3.org/csswg/css-extensions/#custom-selectors)  to more compatible CSS.\n\n[简体中文](README-zh.md)\n\n![GIF Demo](http://gtms01.alicdn.com/tps/i1/TB1ZCe3GVXXXXbzXFXXRi48IXXX-780-610.gif)\n\n## Installation\n\n```console\n$ npm install postcss-custom-selectors\n```\n\n## Quick Start\n\n```js\n// dependencies\nvar fs = require('fs')\nvar postcss = require('postcss')\nvar selector = require('postcss-custom-selectors')\n\n// css to be processed\nvar css = fs.readFileSync('input.css', 'utf8')\n\n// process css using postcss-custom-selectors\nvar output = postcss()\n  .use(selector())\n  .process(css)\n  .css\n\nconsole.log('\\n====>Output CSS:\\n', output)  \n```\n\nOr just:\n\n```js\nvar output = postcss(selector())\n  .process(css)\n  .css\n```\n\ninput:\n\n```css\n@custom-selector :--heading h1, h2, h3, h4, h5, h6;\n\narticle :--heading + p {\n  margin-top: 0;\n}\n```\n\nYou will get:\n\n```css\narticle h1 + p,\narticle h2 + p,\narticle h3 + p,\narticle h4 + p,\narticle h5 + p,\narticle h6 + p {\n  margin-top: 0;\n}\n```\n\n## CSS syntax\n\n```css\n@custom-selector = @custom-selector :<extension-name> <selector>;\n```\n\n## How to use\n\nThe custom selector is a pseudo-class, so you must use `:--` to define it.\n\nFor example to simulate [:any-link](http://dev.w3.org/csswg/selectors/#the-any-link-pseudo) selector:\n\n```css\n@custom-selector :--any-link :link, :visited;\n\na:--any-link {\n  color: blue;\n}\n```\n\noutput:\n\n```css\na:link,\na:visited {\n  color: blue;\n}\n```\n\nYou can even make some smart use like this:\n\n```css\n@custom-selector :--button button, .button;\n@custom-selector :--enter :hover, :focus;\n\n:--button:--enter {\n\n}\n```\n\noutput\n\n```css\nbutton:hover,\n.button:hover,\nbutton:focus,\n.button:focus {\n\n}\n```\n\n## Options\n\n### `lineBreak`\n\n_(default: `true`)_\n\nSet whether  multiple selector wrap.The default is turning on to be a newline.\n\nClose the line breaks.\n\n```js\nvar options = {\n  lineBreak: false\n}\n\nvar output = postcss(selector(options))\n  .process(css)\n  .css\n```\n\nWith the first example, the output will be:\n\n```css\narticle h1 + p, article h2 + p, article h3 + p, article h4 + p, article h5 + p, article h6 + p {\n  margin-top: 0;\n}\n```\n\n### `extensions`\n\n_(default: `{}`)_\n\nThis option allows you to customize an object to set the `<extension-name>` (selector alias) and `<selector>`, these definitions will cover the same alias of `@custom-selector` in CSS.\n\n```js\nvar options = {\n  extensions: {\n    ':--any' : 'section, article, aside, nav'\n  }\n}\n\nvar output = postcss(selector(options))\n  .process(css)\n  .css;\n```\n\ninput.css\n\n```css\n@custom-selector :--any .foo, .bar; /* No effect */\n:--any h1 {\n  margin-top: 16px;\n}\n```\n\noutput:\n\n```css\n/* No effect */\nsection h1,\narticle h1,\naside h1,\nnav h1 {\n  margin-top: 16px;\n}\n```\n\n### `transformMatches`\n\n_(default: `true`)_\n\nAllows you to limit transformation to `:matches()` usage\nIf set to false:\n\ninput\n\n```css\n@custom-selector :--foo .bar, .baz;\n.foo:--foo {\n  margin-top: 16px;\n}\n```\n\noutput\n\n```css\n.foo:matches(.bar, .baz) {\n  margin-top: 16px;\n}\n```\n\n\n## Usage\n\n### Node Watch\n\nDependence [chokidar](https://github.com/paulmillr/chokidar) module.\n\n```js\nvar fs = require('fs')\nvar chokidar = require('chokidar')\nvar postcss = require('postcss')\nvar selector = require('postcss-custom-selectors')\n\nvar src = 'input.css'\n\nconsole.info('Watching…\\nModify the input.css and save.')\n\nchokidar.watch(src, {\n  ignored: /[\\/\\\\]\\./,\n  persistent: true\n}).on('all',\n  function(event, path, stats) {\n    var css = fs.readFileSync(src, 'utf8')\n    var output = postcss(selector())\n      .process(css)\n      .css\n    fs.writeFileSync('output.css', output)\n  })\n```\n\n### Grunt\n\n```js\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    pkg: grunt.file.readJSON('package.json'),\n    postcss: {\n      options: {\n        processors: [\n          require('autoprefixer-core')({ browsers: ['> 0%'] }).postcss, //Other plugin\n          require('postcss-custom-selectors')(),\n        ]\n      },\n      dist: {\n        src: ['src/*.css'],\n        dest: 'build/grunt.css'\n      }\n    }\n  });\n\n  grunt.loadNpmTasks('grunt-contrib-uglify');\n  grunt.loadNpmTasks('grunt-postcss');\n\n  grunt.registerTask('default', ['postcss']);\n}\n```\n\n### Gulp\n\n```js\nvar gulp = require('gulp');\nvar rename = require('gulp-rename');\nvar postcss = require('gulp-postcss');\nvar selector = require('postcss-custom-selectors')\nvar autoprefixer = require('autoprefixer-core')\n\ngulp.task('default', function () {\n    var processors = [\n        autoprefixer({ browsers: ['> 0%'] }), //Other plugin\n        selector()\n    ];\n    gulp.src('src/*.css')\n        .pipe(postcss(processors))\n        .pipe(rename('gulp.css'))\n        .pipe(gulp.dest('build'))\n});\ngulp.watch('src/*.css', ['default']);\n```\n\n## Contributing\n\n* Install the relevant dependent module.\n* Respect coding style（Install [EditorConfig](http://editorconfig.org/)）.\n* Add test cases in the [test](test) directory.\n* Run test.\n\n```console\n$ git clone https://github.com/postcss/postcss-custom-selectors.git\n$ git checkout -b patch\n$ npm install\n$ npm test\n```\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n","repository":{"type":"git","url":"git+https://github.com/postcss/postcss-custom-selectors.git"},"users":{"asaupup":true},"bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"license":"MIT","versions":{"1.0.0":{"name":"postcss-custom-selectors","version":"1.0.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^3.0.0","tape":"^3.0.0"},"scripts":{"test":"tape test"},"bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@1.0.0","_shasum":"629c64f151dac22ec5301c56a17453099c1b0641","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"629c64f151dac22ec5301c56a17453099c1b0641","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-1.0.0.tgz"},"directories":{}},"1.1.0":{"name":"postcss-custom-selectors","version":"1.1.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^3.0.0","tape":"^3.0.0"},"scripts":{"test":"tape test"},"gitHead":"dbaacb2f36a2bf717e1ff1099cdeb5063cf132af","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@1.1.0","_shasum":"d96544f5f4ef5e64fef5e018785ab03149ae0181","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"d96544f5f4ef5e64fef5e018785ab03149ae0181","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-1.1.0.tgz"},"directories":{}},"1.1.1":{"name":"postcss-custom-selectors","version":"1.1.1","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^3.0.0","tape":"^3.0.0"},"scripts":{"test":"tape test"},"gitHead":"d4580b003a17672bc6a7a51126e05666b218f4bc","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@1.1.1","_shasum":"3044498d2d7662ddca3a7d1922ef8d495ebd3582","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"3044498d2d7662ddca3a7d1922ef8d495ebd3582","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-1.1.1.tgz"},"directories":{}},"2.0.0":{"name":"postcss-custom-selectors","version":"2.0.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^3.0.0","tape":"^3.0.0"},"scripts":{"test":"tape test"},"gitHead":"04db227ffb609735c0f3ead890096f45799bb31b","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@2.0.0","_shasum":"40419fc18c58c1c35db786b46a5d6f0799f76d65","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"40419fc18c58c1c35db786b46a5d6f0799f76d65","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-2.0.0.tgz"},"directories":{}},"2.0.1":{"name":"postcss-custom-selectors","version":"2.0.1","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^3.0.0","tape":"^3.0.0"},"scripts":{"test":"tape test"},"gitHead":"f6034c5f92234d08828a0b161963312cecb40c5b","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@2.0.1","_shasum":"ae73d13e90d8f0886576568b099581eb81ade91a","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"ae73d13e90d8f0886576568b099581eb81ade91a","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-2.0.1.tgz"},"directories":{}},"2.1.0":{"name":"postcss-custom-selectors","version":"2.1.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector","custom selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^4.1.11","tape":"^4.0.0"},"scripts":{"test":"tape test"},"gitHead":"675bad97f1014bb770a1ebca2d744cd54cc2cb9d","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@2.1.0","_shasum":"68d5eacc5ab585a5fbed441cec5b55b37b9cbb2c","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"68d5eacc5ab585a5fbed441cec5b55b37b9cbb2c","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-2.1.0.tgz"},"directories":{}},"2.1.1":{"name":"postcss-custom-selectors","version":"2.1.1","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector","custom selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^4.1.11","tape":"^4.0.0"},"scripts":{"test":"tape test"},"gitHead":"e202b8b2d78fa270ba61add39045a2f22f7cd807","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@2.1.1","_shasum":"caee5bd795b9b8af93dca2f5d5182eb16acab6bb","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"caee5bd795b9b8af93dca2f5d5182eb16acab6bb","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-2.1.1.tgz"},"directories":{}},"2.2.0":{"name":"postcss-custom-selectors","version":"2.2.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["css","css3","postcss","postcss-plugins","selector","custom-selector","custom selector"],"author":{"name":"yisi"},"license":"MIT","repository":{"type":"git","url":"https://github.com/postcss/postcss-custom-selectors.git"},"files":["CHANGELOG.md","README-zh.md","LICENSE","index.js"],"devDependencies":{"postcss":"^4.1.11","tape":"^4.0.0"},"scripts":{"test":"tape test"},"gitHead":"01c316292df75a25a71efb1552fbb92e0f35f6e7","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors","_id":"postcss-custom-selectors@2.2.0","_shasum":"250485d29c90040efb754cef9a0ec4d2f2fe8183","_from":".","_npmVersion":"2.1.11","_nodeVersion":"0.10.32","_npmUser":{"name":"yisi","email":"yiorsi@gmail.com"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"}],"dist":{"shasum":"250485d29c90040efb754cef9a0ec4d2f2fe8183","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-2.2.0.tgz"},"directories":{}},"2.3.0":{"name":"postcss-custom-selectors","version":"2.3.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["postcss","postcss-plugin","css","selector","custom-selector"],"authors":["yisi","Maxime Thirouin"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/postcss/postcss-custom-selectors.git"},"homepage":"https://github.com/postcss/postcss-custom-selectors","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"files":["CHANGELOG.md","LICENSE","dist","README-zh.md"],"main":"dist/index.js","dependencies":{"balanced-match":"^0.2.0","postcss":"^4.1.7","postcss-selector-matches":"^1.2.1"},"devDependencies":{"babel":"^5.5.8","babel-eslint":"^3.1.15","babel-tape-runner":"^1.1.0","eslint":"^0.23.0","tape":"^4.0.0"},"scripts":{"prepublish":"babel src --out-dir dist","lint":"eslint .","tape":"babel-tape-runner 'test/*.js'","test":"npm run lint && npm run tape"},"gitHead":"8463e3765ee9d94d1dca8866dcf90ca955b2bee8","_id":"postcss-custom-selectors@2.3.0","_shasum":"71fcd95fc34e39b2a1a589c317b35e7ffabe1332","_from":".","_npmVersion":"2.11.3","_nodeVersion":"2.3.1","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"},{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"71fcd95fc34e39b2a1a589c317b35e7ffabe1332","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-2.3.0.tgz"},"directories":{}},"3.0.0":{"name":"postcss-custom-selectors","version":"3.0.0","description":"PostCSS plugin to transform W3C CSS Extensions(Custom Selectors) to more compatible CSS","keywords":["postcss","postcss-plugin","css","selector","custom-selector"],"authors":["yisi","Maxime Thirouin"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/postcss/postcss-custom-selectors.git"},"main":"dist/index.js","files":["dist","README-zh.md"],"dependencies":{"balanced-match":"^0.2.0","postcss":"^5.0.0","postcss-selector-matches":"^2.0.0"},"devDependencies":{"babel":"^5.5.8","babel-eslint":"^3.1.15","babel-tape-runner":"^1.1.0","eslint":"^1.0.0","tape":"^4.0.0"},"scripts":{"prepublish":"babel src --out-dir dist","lint":"eslint .","tape":"babel-tape-runner 'test/*.js'","test":"npm run lint && npm run tape"},"gitHead":"a96a66012344e922399107fd0770f75672b608a2","bugs":{"url":"https://github.com/postcss/postcss-custom-selectors/issues"},"homepage":"https://github.com/postcss/postcss-custom-selectors#readme","_id":"postcss-custom-selectors@3.0.0","_shasum":"8f81249f5ed07a8d0917cf6a39fe5b056b7f96ac","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.0.0","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"yisi","email":"yiorsi@gmail.com"},{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"8f81249f5ed07a8d0917cf6a39fe5b056b7f96ac","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/postcss-custom-selectors/-/postcss-custom-selectors-3.0.0.tgz"},"directories":{}}},"name":"postcss-custom-selectors","time":{"modified":"2016-10-28T06:13:24.642Z","created":"2014-12-05T15:33:46.543Z","1.0.0":"2014-12-05T15:33:46.543Z","1.1.0":"2014-12-13T00:40:15.074Z","1.1.1":"2015-05-07T03:37:03.897Z","2.0.0":"2015-05-29T15:28:45.954Z","2.0.1":"2015-06-03T09:01:48.798Z","2.1.0":"2015-06-04T06:18:40.802Z","2.1.1":"2015-06-30T15:03:07.972Z","2.2.0":"2015-07-01T02:26:49.016Z","2.3.0":"2015-07-14T16:57:20.699Z","3.0.0":"2015-08-25T05:25:18.430Z"},"readmeFilename":"README.md","homepage":"https://github.com/postcss/postcss-custom-selectors#readme"}