{"name":"postcss-simple-extend","author":{"name":"David Clark","email":"david.dave.clark@gmail.com","url":"http://davidtheclark.com"},"license":"MIT","version":"0.3.2","description":"Simple extends for PostCSS","homepage":"https://github.com/davidtheclark/postcss-simple-extend","repository":{"type":"git","url":"git+https://github.com/davidtheclark/postcss-simple-extend.git"},"keywords":["css","postcss","postcss-plugin","mixin","clone","extend"],"files":["index.js","LICENSE","README.md","CHANGELOG.md"],"main":"index.js","scripts":{"lint":"eslint index.js test/index.js","test":"npm run lint && tape test"},"dependencies":{"postcss":"^4.1.0"},"devDependencies":{"eslint":"0.24.1","tape":"4.0.0"},"gitHead":"060c11bee26dbc4b2bc1594b944f22cda994b472","bugs":{"url":"https://github.com/davidtheclark/postcss-simple-extend/issues"},"_id":"postcss-simple-extend@0.3.2","_shasum":"5fc852f15747de5c5907d0c896550d8a2401ffc0","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.6","_npmUser":{"name":"davidtheclark","email":"david.dave.clark@gmail.com"},"maintainers":[{"name":"davidtheclark","email":"david.dave.clark@gmail.com"}],"dist":{"shasum":"5fc852f15747de5c5907d0c896550d8a2401ffc0","tarball":"http://registry-npm.ywwl.com/postcss-simple-extend/download/postcss-simple-extend-0.3.2.tgz","integrity":"sha512-SVEX601ssvnG6YMqa7Og8maerGgCTw0EU/wmhOj5drDvC4XWm6BBOfk3WtvvxaGkQQIGATkjZ0mHhQfRot4w6w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEFcvlrHLS5/kxfLTPRB3aEjOqYOetaKYxMD6XQAsPw8AiAZcbVy5M4tJRPU+SM7Af9NZnH6dhs2/qi7Xe8P1Jtr9w=="}],"size":4375,"noattachment":false,"key":"/postcss-simple-extend/-/postcss-simple-extend-0.3.2.tgz"},"directories":{},"readme":"# postcss-simple-extend [![Build Status](https://travis-ci.org/davidtheclark/postcss-simple-extend.svg?branch=master)](https://travis-ci.org/davidtheclark/postcss-simple-extend)\n\n**A [PostCSS](https://github.com/postcss/postcss) plugin that enables you to extend placeholder selectors in CSS.**\n\nUse this plugin to define a rule set with an abstract, extendable selector — a \"placeholder selector\" — to which you can, later on, add concrete selectors from other rule sets.\n\nThe functionality should mirror Sass's `@extend` with `%` placeholders (a.k.a. \"silent classes\").\nUnlike Sass's `@extend`, however, *this plugin does not enable you to extend real selectors*: i.e. you cannot `@extend .classname` or `@extend ul > li + li > span a`.\nThat key difference makes this plugin *much* more simple, and arguably much less dangerous.\nMany of the potential problems with Sass's `@extend` simply do not apply to this limited, more *simple* version. Smart Sass users often recommend to only ever `@extend` placeholders (cf. [Harry Robert](http://csswizardry.com/2014/01/extending-silent-classes-in-sass/) and [Hugo Giraudel](http://sass-guidelin.es/#extend)): *with this plugin, that recommendation is enforced*.\n\nIf you are looking for a more full-featured `@extend`, check out [`postcss-extend`](https://github.com/travco/postcss-extend).\n\n> **A Note on \"mixins\" & \"extends\"**: Mixins copy declarations from an abstract definition into a concrete rule set. The simple extend supported by this plugin clones a concrete rule set's selector and adds it to an abstract placeholder selector. If you would like to use mixins, as well — or instead — have a look at [`postcss-mixins`](https://github.com/postcss/postcss-mixins).\n>\n> Also think about this: *Should* you use an `@extend` instead of a `@mixin`? The answer: *maybe not*. Given the fact that [`@extend`s don't actually reduce generated file size (after gzip)](https://tech.bellycard.com/blog/sass-mixins-vs-extends-the-data/), and the CSS generated by mixins is easier to read and understand, *you might not want to introduce `@extend`s to your codebase*. Just consider.\n\n## Installation\n\n```\nnpm install postcss-simple-extend --save\n```\n\nThis plugin is compatible with PostCSS v4.1+.\n\n## Example Input-Output\n\nInput:\n```css\n@define-placeholder gigantic {\n  font-size: 40em;\n}\n\n.foo {\n  @extend gigantic;\n  color: red;\n}\n\n.bar {\n  @extend gigantic;\n  color: orange;\n}\n```\n\nOutput:\n```css\n.foo,\n.bar {\n  font-size: 40em;\n}\n\n.foo {\n  color: red;\n}\n\n.bar {\n  color: orange;\n}\n```\n\n## Usage\n\n### Define Your Placeholder\n\nWith `@define-placeholder`, you associate a rule set with a placeholder selector, which you will later extend with concrete selectors.\n\nYou can also use `@define-extend` or `@simple-extend-define`, if either of those better fits your mind and situation.\n\n```css\n@define-placeholder simple-list {\n  list-style-type: none;\n  margin: 0;\n  padding: 0;\n}\n/* or @define-extend simple-list {...} */\n/* or @simple-extend-define simple-list {...} */\n```\n\n`@define-placeholder` at-rules, and the placeholder names (e.g. `simple-list`, above), will be removed entirely from the generated CSS, replaced by the selectors you've added via `@extend` (see example above).\n\nThere are some defining guidelines to obey (violations should log warnings):\n- Definitions must occur at the root level (i.e. not inside statements, such as rule sets or `@media` blocks).\n- Definitions should only contain declarations and comments: no statements.\n\n### Extend a Placeholder (Add Selectors to It)\n\nUse the at-rule `@extend` within a rule set to add that rule set's selector(s) to a placeholder (which was defined via `@define-placeholder`).\n\nYou can also use `@simple-extend-addto`, if that better fits your mind and situation.\n\n```css\n.list-i-want-to-be-simple {\n  @extend simple-list;\n  /* or @simple-extend-addto simple-list; */\n  font-size: 40em;\n}\n```\n\nAnd there are some `@extend` guidelines to obey (violations should log warnings):\n- `@extend` must *not* occur at the root level: only inside rule sets.\n- `@extend` must *not* occur within `@media` statements. (The generated code almost certainly would not match your intention.)\n- The placeholder must be defined *before* `@extend` can refer to it.\n\n### Plug it in to PostCSS\n\nPlug it in just like any other PostCSS plugin. There are no frills and no options, so integration should be straightforward. For example (as a node script):\n\n```js\nvar fs = require('fs');\nvar postcss = require('postcss');\nvar simpleExtend = require('postcss-simple-extend');\n\nvar inputCss = fs.readFileSync('input.css', 'utf8');\n\nvar outputCss = postcss()\n  .use(simpleExtend())\n  // or .use(simpleExtend)\n  .process(inputCss)\n  .css;\n\nconsole.log(outputCss);\n```\n\nOr take advantage of [any of the myriad other ways to consume PostCSS](https://github.com/postcss/postcss#usage), and follow the plugin instructions they provide.\n","publish_time":1436644636443,"_cnpm_publish_time":1436644636443,"dist-tags":{"latest":"1.0.0"}}