{"name":"postcss-message-helpers","version":"1.1.1","description":"PostCSS helpers to throw or output GNU style messages","keywords":["css","postcss","postcss-plugins","messages","error","warning"],"author":{"name":"Maxime Thirouin"},"license":"MIT","repository":{"type":"git","url":"https://github.com/MoOx/postcss-message-helpers.git"},"files":["CHANGELOG.md","LICENSE","index.js"],"devDependencies":{"jscs":"^1.6.2","jshint":"^2.5.6","postcss":"^3.0.0","tape":"^3.0.0"},"scripts":{"lint":"jscs *.js **/*.js && jshint . --exclude-path .gitignore","test":"npm run lint && tape test"},"gitHead":"e93bbce620eccd78ca0ab251514e831eeca0e507","bugs":{"url":"https://github.com/MoOx/postcss-message-helpers/issues"},"homepage":"https://github.com/MoOx/postcss-message-helpers","_id":"postcss-message-helpers@1.1.1","_shasum":"ce857447ae58c8ec1087e0d4abf0982ab4fdeaa2","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"ce857447ae58c8ec1087e0d4abf0982ab4fdeaa2","tarball":"http://registry-npm.ywwl.com/postcss-message-helpers/download/postcss-message-helpers-1.1.1.tgz","integrity":"sha512-q9dKdjOU3vasjfhl0uSjuzeRSRkK9Wr4PB/eghS9yV6rGvmRkLcCe7EaaKtoy6QewdjWepoD8J6CSNaUTUWc4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG973NjjYeD4EpORWXS6ew4As6XmwWdhhgNGF3E7Vy3VAiB3LJdtyJE1jSdEArqA36KIcgLkvI8MewJAnQ6ffoTstw=="}],"size":2810,"noattachment":false,"key":"/postcss-message-helpers/-/postcss-message-helpers-1.1.1.tgz"},"directories":{},"readme":"# postcss-message-helpers [![Build Status](https://travis-ci.org/MoOx/postcss-message-helpers.png)](https://travis-ci.org/MoOx/postcss-message-helpers)\n\n> [PostCSS](https://github.com/postcss/postcss) helpers to throw or output GNU style messages.\n\nThis modules offers you some function to throw or just output messages with [GNU style](https://www.gnu.org/prep/standards/html_node/Errors.html): `sourcefile:lineno:column: message`\n\n## Installation\n\n```console\n$ npm install postcss-message-helpers\n```\n\n```js\nvar messageHelpers = require(\"postcss-message-helpers\")\n```\n\n## Usage\n\n### `var fnValue = messageHelpers.try(fn, source)`\n\nExecute `fn` an return the value.\nIf an exception is thrown during the process, the exception will be catched, enhanced from source & re-throw.\n\n### `var sourceMessage = messageHelpers.message(message, source)`\n\nReturns a message like `sourcefile:lineno:column: message`.  \n`source` should be a postcss source object from a node.\n\n### `var source = messageHelpers.source(source)`\n\nReturns `sourcefile:lineno:column` for a given `source` postcss object.\n\n### Example\n\n```js\n// dependencies\nvar fs = require(\"fs\")\nvar postcss = require(\"postcss\")\nvar messageHelpers = require(\"postcss-message-helpers\")\n\n// css to be processed\nvar css = fs.readFileSync(\"input.css\", \"utf8\")\n\n// process css\nvar output = postcss()\n  .use(function(styles) {\n    styles.eachDecl(function transformDecl(decl) {\n      // will catch, adjust error stack, line, column & message (gnu style) then re-throw\n      messageHelpers.try(function IwillThrow() {\n        if (decl.value.indexOf(\"error(\") > -1) {\n          throw new Error(\"error detected: \" + decl.value)\n        }\n      }, decl.source)\n\n      // will output a gnu style warning\n      if (decl.value.indexOf(\"warning(\") > -1) {\n        console.warning(messageHelpers.message(\"warning: \" + decl.value, decl.source))\n      }\n    })\n  })\n  .process(css)\n  .css\n```\n\nCheckout [tests](test) for more examples.\n\n---\n\n## Contributing\n\nWork on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.\n\n    $ git clone https://github.com/MoOx/postcss-message-helpers.git\n    $ git checkout -b patch-1\n    $ npm install\n    $ npm test\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n","publish_time":1416906122488,"_cnpm_publish_time":1416906122488,"dist-tags":{"latest":"2.0.0"}}