{"name":"postcss-load-config","version":"1.0.0-alpha","keywords":["PostCSS","Autoload","Config"],"author":{"name":"Michael Ciniawky","email":"michael.ciniawsky@gmail.com"},"license":"MIT","_id":"postcss-load-config@1.0.0-alpha","maintainers":[{"name":"michael-ciniawsky","email":"michael.ciniawsky@gmail.com"}],"homepage":"https://github.com/michael-ciniawsky/postcss-load-config#readme","bugs":{"url":"https://github.com/michael-ciniawsky/postcss-load-config/issues"},"ava":{"babel":"inherit"},"nyc":{"all":true,"include":["lib","test"],"require":"babel-register","extension":[".js"]},"dist":{"shasum":"593ca9197c9e0ebce5697d1325a5c5efb0139efd","tarball":"http://registry-npm.ywwl.com/postcss-load-config/download/postcss-load-config-1.0.0-alpha.tgz","integrity":"sha512-79aDXT8skLonBx1B0pVfwpu9BdyN9yUJvsFmdc20boOenm7oNHyiX8n8uYcUYUdI7jmpqZ+vDcT+68S+7LhK5A==","signatures":[{"sig":"MEUCIBzK8HhbrRxWxHif8sksn4T4TTR1UBgd9GyNTGX1RRn4AiEAujpQirz9VtAQSF5MBFwcgyT9S/UzrShUjUUQ1d05lfU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":3903,"noattachment":false,"key":"/postcss-load-config/-/postcss-load-config-1.0.0-alpha.tgz"},"main":"index.js","_from":".","babel":{"env":{"development":{"sourceMaps":"inline"}},"presets":["es2015"]},"_shasum":"593ca9197c9e0ebce5697d1325a5c5efb0139efd","engines":{"node":">=4"},"gitHead":"5088f1535cdbd8255a3ab1ad767ae88ca6497039","scripts":{"test":"echo '=> Testing' && nyc ava './test/index.js'","clean":"echo '=> Cleaning' && rm -rf .nyc_output coverage test/node_modules","start":"echo '=> Starting' && sudo npm test","pretest":"echo '=> Linting' && npm run clean && standard"},"_npmUser":{"name":"michael-ciniawsky","email":"michael.ciniawsky@gmail.com"},"standard":{"ignore":[]},"repository":{"url":"git+https://github.com/michael-ciniawsky/postcss-load-config.git","type":"git"},"_npmVersion":"3.9.5","description":"Autoload Config for PostCSS","directories":{},"_nodeVersion":"6.2.0","dependencies":{"cosmiconfig":"^1.1.0"},"devDependencies":{"ava":"^0.15.1","nyc":"^6.4.4","postcss":"^5.0.21","sugarss":"^0.1.3","standard":"^7.1.1","coveralls":"^2.11.9","babel-core":"^6.9.1","postcss-bem":"^0.4.1","postcss-less":"^0.12.0","postcss-scss":"^0.1.8","babel-register":"^6.9.0","postcss-import":"^8.1.2","postcss-nested":"^1.0.0","babel-preset-es2015":"^6.9.0"},"_npmOperationalInternal":{"tmp":"tmp/postcss-load-config-1.0.0-alpha.tgz_1464792383282_0.15225055231712759","host":"packages-16-east.internal.npmjs.com"},"readme":"\n\n<div align=\"center\">\n  <img width=\"100\" height=\"100\" title=\"Load Options\" src=\"http://michael-ciniawsky.github.io/postcss-load-options/logo.svg\">\n  <a href=\"https://github.com/postcss/postcss\">\n    <img width=\"110\" height=\"110\" title=\"PostCSS\"           src=\"http://postcss.github.io/postcss/logo.svg\" hspace=\"10\">\n  </a>\n  <img width=\"100\" height=\"100\" title=\"Load Plugins\" src=\"http://michael-ciniawsky.github.io/postcss-load-plugins/logo.svg\">\n  <h1>Load Config</h1>\n</div>\n\n<h2 align=\"center\">Install</h2>\n\n```bash\nnpm i -D postcss-load-config\n```\n\n<h2 align=\"center\">Usage</h2>\n\n```bash\nnpm i -S|-D postcss-plugin\n```\n\nInstall all required PostCSS plugins and save them to your **package.json** `dependencies`/`devDependencies`\n\nThen create a PostCSS config file by choosing one of the following formats\n\n### `package.json`\n\nCreate a **`postcss`** section in your project's **`package.json`**\n\n```\nProject (Root)\n  |– client\n  |– public\n  |\n  |- package.json\n```\n\n```json\n{\n  \"postcss\": {\n    \"parser\": \"sugarss\",\n    \"map\": false,\n    \"plugins\": {\n      \"postcss-plugin\": {}\n    }\n  }\n}\n```\n\n### `.postcssrc`\n\nCreate a **`.postcssrc`** file in JSON or YAML format\n\n> ℹ️ It's recommended to use an extension (e.g **`.postcssrc.json`** or **`.postcssrc.yml`**) instead of `.postcssrc`\n\n```\nProject (Root)\n  |– client\n  |– public\n  |\n  |- (.postcssrc|.postcssrc.json|.postcssrc.yml)\n  |- package.json\n```\n\n**`.postcssrc.json`**\n```json\n{\n  \"parser\": \"sugarss\",\n  \"map\": false,\n  \"plugins\": {\n    \"postcss-plugin\": {}\n  }\n}\n```\n\n**`.postcssrc.yml`**\n```yaml\nparser: sugarss\nmap: false\nplugins:\n  postcss-plugin: {}\n```\n\n> [!NOTE]\n> For YAML configs, you must have [yaml](https://www.npmjs.com/package/yaml) installed as a peer dependency.\n\n### `.postcssrc.js` or `postcss.config.js`\n\nYou may need some logic within your config.\nIn this case create JS/TS file named:\n- `.postcssrc.js`\n- `.postcssrc.mjs`\n- `.postcssrc.cjs`\n- `.postcssrc.ts`\n- `.postcssrc.mts`\n- `.postcssrc.cts`\n- `postcss.config.js`\n- `postcss.config.mjs`\n- `postcss.config.cjs`\n- `postcss.config.ts`\n- `postcss.config.mts`\n- `postcss.config.cts`\n\n> [!NOTE]\n> For TypeScript configs, you must have [tsx](https://www.npmjs.com/package/tsx) or [jiti](https://www.npmjs.com/package/jiti) installed as a peer dependency.\n\n```\nProject (Root)\n  |– client\n  |– public\n  |- (.postcssrc|postcss.config).(js|mjs|cjs|ts|mts|cts)\n  |- package.json\n```\n\nYou can export the config as an `{Object}`\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  parser: 'sugarss',\n  map: false,\n  plugins: {\n    'postcss-plugin': {}\n  }\n}\n```\n\nOr export a `{Function}` that returns the config (more about the `ctx` param below)\n\n**.postcssrc.js**\n```js\nmodule.exports = (ctx) => ({\n  parser: ctx.parser ? 'sugarss' : false,\n  map: ctx.env === 'development' ? ctx.map : false,\n  plugins: {\n    'postcss-plugin': ctx.options.plugin\n  }\n})\n```\n\nPlugins can be loaded either using an `{Object}` or an `{Array}`\n\n#### `{Object}`\n\n**.postcssrc.js**\n```js\nmodule.exports = ({ env }) => ({\n  ...options,\n  plugins: {\n    'postcss-plugin': env === 'production' ? {} : false\n  }\n})\n```\n\n> ℹ️ When using an `{Object}`, the key can be a Node.js module name, a path to a JavaScript file that is relative to the directory of the PostCSS config file, or an absolute path to a JavaScript file.\n\n#### `{Array}`\n\n**.postcssrc.js**\n```js\nmodule.exports = ({ env }) => ({\n  ...options,\n  plugins: [\n    env === 'production' ? require('postcss-plugin')() : false\n  ]\n})\n```\n> :warning: When using an `{Array}`, make sure to `require()` each plugin\n\n<h2 align=\"center\">Options</h2>\n\n|Name|Type|Default|Description|\n|:--:|:--:|:-----:|:----------|\n|[**`to`**](#to)|`{String}`|`undefined`|Destination File Path|\n|[**`map`**](#map)|`{String\\|Object}`|`false`|Enable/Disable Source Maps|\n|[**`from`**](#from)|`{String}`|`undefined`|Source File Path|\n|[**`parser`**](#parser)|`{String\\|Function}`|`false`|Custom PostCSS Parser|\n|[**`syntax`**](#syntax)|`{String\\|Function}`|`false`|Custom PostCSS Syntax|\n|[**`stringifier`**](#stringifier)|`{String\\|Function}`|`false`|Custom PostCSS Stringifier|\n\n### `parser`\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  parser: 'sugarss'\n}\n```\n\n### `syntax`\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  syntax: 'postcss-scss'\n}\n```\n\n### `stringifier`\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  stringifier: 'midas'\n}\n```\n\n### [**`map`**](https://github.com/postcss/postcss/blob/master/docs/source-maps.md)\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  map: 'inline'\n}\n```\n\n> :warning: In most cases `options.from` && `options.to` are set by the third-party which integrates this package (CLI, gulp, webpack). It's unlikely one needs to set/use `options.from` && `options.to` within a config file. Unless you're a third-party plugin author using this module and its Node API directly **dont't set `options.from` && `options.to` yourself**\n\n### `to`\n\n```js\nmodule.exports = {\n  to: 'path/to/dest.css'\n}\n```\n\n### `from`\n\n```js\nmodule.exports = {\n  from: 'path/to/src.css'\n}\n```\n\n<h2 align=\"center\">Plugins</h2>\n\n### `{} || null`\n\nThe plugin will be loaded with defaults\n\n```js\n'postcss-plugin': {} || null\n```\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  plugins: {\n    'postcss-plugin': {} || null\n  }\n}\n```\n\n> :warning: `{}` must be an **empty** `{Object}` literal\n\n### `{Object}`\n\nThe plugin will be loaded with given options\n\n```js\n'postcss-plugin': { option: '', option: '' }\n```\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  plugins: {\n    'postcss-plugin': { option: '', option: '' }\n  }\n}\n```\n\n### `false`\n\nThe plugin will not be loaded\n\n```js\n'postcss-plugin': false\n```\n\n**.postcssrc.js**\n```js\nmodule.exports = {\n  plugins: {\n    'postcss-plugin': false\n  }\n}\n```\n\n### `Ordering`\n\nPlugin **execution order** is determined by declaration in the plugins section (**top-down**)\n\n```js\n{\n  plugins: {\n    'postcss-plugin': {}, // [0]\n    'postcss-plugin': {}, // [1]\n    'postcss-plugin': {}  // [2]\n  }\n}\n```\n\n<h2 align=\"center\">Context</h2>\n\nWhen using a `{Function}` (`postcss.config.js` or `.postcssrc.js`), it's possible to pass context to `postcss-load-config`, which will be evaluated while loading your config. By default `ctx.env (process.env.NODE_ENV)` and `ctx.cwd (process.cwd())` are available on the `ctx` `{Object}`\n\n> ℹ️ Most third-party integrations add additional properties to the `ctx` (e.g `postcss-loader`). Check the specific module's README for more information about what is available on the respective `ctx`\n\n<h2 align=\"center\">Examples</h2>\n\n**postcss.config.js**\n\n```js\nmodule.exports = (ctx) => ({\n  parser: ctx.parser ? 'sugarss' : false,\n  map: ctx.env === 'development' ? ctx.map : false,\n  plugins: {\n    'postcss-import': {},\n    'postcss-nested': {},\n    cssnano: ctx.env === 'production' ? {} : false\n  }\n})\n```\n\n<div align=\"center\">\n  <img width=\"80\" height=\"80\" src=\"https://worldvectorlogo.com/logos/nodejs-icon.svg\">\n</div>\n\n```json\n\"scripts\": {\n  \"build\": \"NODE_ENV=production node postcss\",\n  \"start\": \"NODE_ENV=development node postcss\"\n}\n```\n\n```js\nconst { readFileSync } = require('fs')\n\nconst postcss = require('postcss')\nconst postcssrc = require('postcss-load-config')\n\nconst css = readFileSync('index.css', 'utf8')\n\nconst ctx = { parser: true, map: 'inline' }\n\npostcssrc(ctx).then(({ plugins, options }) => {\n  postcss(plugins)\n    .process(css, options)\n    .then((result) => console.log(result.css))\n})\n```\n\n<div align=\"center\">\n  <img width=\"80\" height=\"80\" halign=\"10\" src=\"https://worldvectorlogo.com/logos/gulp.svg\">\n</div>\n\n```json\n\"scripts\": {\n  \"build\": \"NODE_ENV=production gulp\",\n  \"start\": \"NODE_ENV=development gulp\"\n}\n```\n\n```js\nconst { task, src, dest, series, watch } = require('gulp')\n\nconst postcss = require('gulp-postcssrc')\n\nconst css = () => {\n  src('src/*.css')\n    .pipe(postcss())\n    .pipe(dest('dest'))\n})\n\ntask('watch', () => {\n  watch(['src/*.css', 'postcss.config.js'], css)\n})\n\ntask('default', series(css, 'watch'))\n```\n\n<div align=\"center\">\n  <img width=\"80\" height=\"80\" src=\"https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg\">\n</div>\n\n```json\n\"scripts\": {\n  \"build\": \"NODE_ENV=production webpack\",\n  \"start\": \"NODE_ENV=development webpack-dev-server\"\n}\n```\n\n**webpack.config.js**\n```js\nmodule.exports = (env) => ({\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        use: [\n          'style-loader',\n          'css-loader',\n          'postcss-loader'\n        ]\n      }\n    ]\n  }\n})\n```\n\n<h2 align=\"center\">Maintainers</h2>\n\n<table>\n  <tbody>\n   <tr>\n    <td align=\"center\">\n      <img width=\"150\" height=\"150\"\n        src=\"https://github.com/michael-ciniawsky.png?v=3&s=150\">\n      <br />\n      <a href=\"https://github.com/michael-ciniawsky\">Michael Ciniawsky</a>\n    </td>\n    <td align=\"center\">\n      <img width=\"150\" height=\"150\"\n        src=\"https://github.com/ertrzyiks.png?v=3&s=150\">\n      <br />\n      <a href=\"https://github.com/ertrzyiks\">Mateusz Derks</a>\n    </td>\n  </tr>\n  <tbody>\n</table>\n\n<h2 align=\"center\">Contributors</h2>\n\n<table>\n  <tbody>\n   <tr>\n    <td align=\"center\">\n      <img width=\"150\" height=\"150\"\n        src=\"https://github.com/sparty02.png?v=3&s=150\">\n      <br />\n      <a href=\"https://github.com/sparty02\">Ryan Dunckel</a>\n    </td>\n    <td align=\"center\">\n      <img width=\"150\" height=\"150\"\n        src=\"https://github.com/pcgilday.png?v=3&s=150\">\n      <br />\n      <a href=\"https://github.com/pcgilday\">Patrick Gilday</a>\n    </td>\n    <td align=\"center\">\n      <img width=\"150\" height=\"150\"\n        src=\"https://github.com/daltones.png?v=3&s=150\">\n      <br />\n      <a href=\"https://github.com/daltones\">Dalton Santos</a>\n    </td>\n    <td align=\"center\">\n      <img width=\"150\" height=\"150\"\n        src=\"https://github.com/fwouts.png?v=3&s=150\">\n      <br />\n      <a href=\"https://github.com/fwouts\">François Wouts</a>\n    </td>\n  </tr>\n  <tbody>\n</table\n\n\n## Security Contact\n\nTo report a security vulnerability, please use the [Tidelift security contact].\nTidelift will coordinate the fix and disclosure.\n\n[Tidelift security contact]: https://tidelift.com/security\n","publish_time":1464792384520,"_cnpm_publish_time":1464792384520,"dist-tags":{"latest":"6.0.1"}}