package.json
12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
"_args": [
[
{
"raw": "postcss-load-config@^1.2.0",
"scope": null,
"escapedName": "postcss-load-config",
"name": "postcss-load-config",
"rawSpec": "^1.2.0",
"spec": ">=1.2.0 <2.0.0",
"type": "range"
},
"D:\\100-Projects\\100-AIAHTML5\\400-SOURCECODE\\AIAHTML5.Admin\\node_modules\\postcss-loader"
]
],
"_from": "postcss-load-config@>=1.2.0 <2.0.0",
"_id": "postcss-load-config@1.2.0",
"_inCache": true,
"_location": "/postcss-load-config",
"_nodeVersion": "7.5.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/postcss-load-config-1.2.0.tgz_1486952724378_0.6930401120334864"
},
"_npmUser": {
"name": "michael-ciniawsky",
"email": "michael.ciniawsky@gmail.com"
},
"_npmVersion": "4.1.2",
"_phantomChildren": {},
"_requested": {
"raw": "postcss-load-config@^1.2.0",
"scope": null,
"escapedName": "postcss-load-config",
"name": "postcss-load-config",
"rawSpec": "^1.2.0",
"spec": ">=1.2.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/postcss-loader"
],
"_resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-1.2.0.tgz",
"_shasum": "539e9afc9ddc8620121ebf9d8c3673e0ce50d28a",
"_shrinkwrap": null,
"_spec": "postcss-load-config@^1.2.0",
"_where": "D:\\100-Projects\\100-AIAHTML5\\400-SOURCECODE\\AIAHTML5.Admin\\node_modules\\postcss-loader",
"author": {
"name": "Michael Ciniawky",
"email": "michael.ciniawsky@gmail.com"
},
"bugs": {
"url": "https://github.com/michael-ciniawsky/postcss-load-config/issues"
},
"contributors": [
{
"name": "Mateusz Derks",
"url": "http://ertrzyiks.me"
},
{
"name": "Ryan Dunckel",
"email": "sparty02@gmail.com"
},
{
"name": "Patrick Gilday"
},
{
"name": "Dalton Santos"
}
],
"dependencies": {
"cosmiconfig": "^2.1.0",
"object-assign": "^4.1.0",
"postcss-load-options": "^1.2.0",
"postcss-load-plugins": "^2.3.0"
},
"description": "Autoload Config for PostCSS",
"devDependencies": {
"ava": "^0.18.1",
"coveralls": "^2.11.16",
"cssnano": "^3.10.0",
"jsdoc-to-markdown": "^3.0.0",
"nyc": "^10.1.0",
"postcss": "^5.2.12",
"postcss-cssnext": "^2.8.0",
"postcss-import": "^9.1.0",
"postcss-nested": "^1.0.0",
"postcss-scss": "^0.4.0",
"postcss-sprites": "^4.2.0",
"standard": "^8.6.0",
"standard-changelog": "0.0.1",
"sugarss": "^0.2.0"
},
"directories": {},
"dist": {
"shasum": "539e9afc9ddc8620121ebf9d8c3673e0ce50d28a",
"tarball": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-1.2.0.tgz"
},
"engines": {
"node": ">=0.12"
},
"files": [
"index.js"
],
"gitHead": "a97396c6c9ede81a05e6dceab1a9c2aa896803bf",
"homepage": "https://github.com/michael-ciniawsky/postcss-load-config#readme",
"keywords": [
"postcss",
"postcss-config"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "michael-ciniawsky",
"email": "michael.ciniawsky@gmail.com"
}
],
"name": "postcss-load-config",
"optionalDependencies": {},
"readme": "[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![code style][style]][style-url]\n[![chat][chat]][chat-url]\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```\nnpm i -S|-D postcss-plugin\n```\n\nInstall plugins and save them to your ***package.json*** dependencies/devDependencies.\n\n### `package.json`\n\nCreate **`postcss`** section in your projects **`package.json`**.\n\n```\nApp\n |– client\n |– public\n |\n |- package.json\n```\n\n```json\n{\n \"postcss\": {\n \"parser\": \"sugarss\",\n \"map\": false,\n \"from\": \"/path/to/src.sss\",\n \"to\": \"/path/to/dest.css\",\n \"plugins\": {\n \"postcss-plugin\": {}\n }\n }\n}\n```\n\n### `.postcssrc`\n\nCreate a **`.postcssrc`** file in JSON or YAML format.\n\nIt's also allowed to use extensions (**`.postcssrc.json`** or **`.postcssrc.yaml`**). That could help your text editor to properly interpret the file.\n\n```\nApp\n |– client\n |– public\n |\n |- (.postcssrc|.postcssrc.json|.postcssrc.yaml)\n |- package.json\n```\n\n**`JSON`**\n```json\n{\n \"parser\": \"sugarss\",\n \"map\": false,\n \"from\": \"/path/to/src.sss\",\n \"to\": \"/path/to/dest.css\",\n \"plugins\": {\n \"postcss-plugin\": {}\n }\n}\n```\n\n**`YAML`**\n```yaml\nparser: sugarss\nmap: false\nfrom: \"/path/to/src.sss\"\nto: \"/path/to/dest.css\"\nplugins:\n postcss-plugin: {}\n```\n\n### `postcss.config.js` or `.postcssrc.js`\n\nYou may need some JavaScript logic to generate your config. For this case you can use a file named **`postcss.config.js`** or **`.postcssrc.js`**.\n\n```\nApp\n |– client\n |– public\n |\n |- (postcss.config.js|.postcssrc.js)\n |- package.json\n```\n\nYou can export the config as an `{Object}`\n\n```js\nmodule.exports = {\n parser: 'sugarss',\n map: false,\n from: '/path/to/src.sss',\n to: '/path/to/dest.css',\n plugins: {\n 'postcss-plugin': {}\n }\n}\n```\n\nOr export a `{Function}` that returns the config (more about the param `ctx` below)\n\n```js\nmodule.exports = (ctx) => ({\n parser: ctx.parser ? 'sugarss' : false,\n map: ctx.env === 'development' ? ctx.map : false,\n from: ctx.from,\n to: ctx.to,\n plugins: {\n 'postcss-plugin': ctx.plugin\n }\n})\n```\n\nPlugins can be loaded in either using an `{Object}` or an `{Array}`.\n\n##### `{Object}`\n\n```js\nmodule.exports = (ctx) => ({\n ...options\n plugins: {\n 'postcss-plugin': ctx.plugin\n }\n})\n```\n\n##### `{Array}`\n\n```js\nmodule.exports = (ctx) => ({\n ...options\n plugins: [\n require('postcss-plugin')(ctx.plugin)\n ]\n})\n```\n> :warning: When using an Array, make sure to `require()` them.\n\n<h2 align=\"center\">Options</h2>\n\n**`parser`**:\n\n```js\n'parser': 'sugarss'\n```\n\n**`syntax`**:\n\n```js\n'syntax': 'postcss-scss'\n```\n**`stringifier`**:\n\n```js\n'stringifier': 'midas'\n```\n\n[**`map`**:](https://github.com/postcss/postcss/blob/master/docs/source-maps.md)\n\n```js\n'map': 'inline'\n```\n\n**`from`**:\n\n```js\nfrom: 'path/to/src.css'\n```\n\n**`to`**:\n\n```js\nto: 'path/to/dest.css'\n```\n\n<h2 align=\"center\">Plugins</h2>\n\n### Options\n\n**`{} || null`**: Plugin loads with defaults.\n\n```js\n'postcss-plugin': {} || null\n```\n> :warning: `{}` must be an **empty** object\n\n**`[Object]`**: Plugin loads with given options.\n\n```js\n'postcss-plugin': { option: '', option: '' }\n```\n\n**`false`**: Plugin will not be loaded.\n\n```js\n'postcss-plugin': false\n```\n\n### Order\n\nPlugin **order** is determined by declaration in the plugins section.\n\n```js\n{\n plugins: {\n 'postcss-plugin': {}, // plugins[0]\n 'postcss-plugin': {}, // plugins[1]\n 'postcss-plugin': {} // plugins[2]\n }\n}\n```\n\n<h2 align=\"center\">Context</h2>\n\nWhen using a function (`postcss.config.js` or `.postcssrc.js`), it is 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.\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### <img width=\"80\" height=\"80\" src=\"https://worldvectorlogo.com/logos/nodejs-icon.svg\">\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.sss', '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### <img width=\"80\" height=\"80\" src=\"https://worldvectorlogo.com/logos/gulp.svg\">\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### <img width=\"80\" height=\"80\" src=\"https://worldvectorlogo.com/logos/webpack.svg\">\n\n```json\n\"scripts\": {\n \"build\": \"NODE_ENV=production webpack\",\n \"start\": \"NODE_ENV=development webpack-dev-server\"\n}\n```\n\n```js\nmodule.exports = (env) => ({\n module: {\n rules: [\n {\n test: /\\.css$/\n use: [\n 'style-loader',\n {\n loader: 'css-loader',\n options: { importLoaders: 1 } }\n },\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://avatars.githubusercontent.com/u/5419992?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://avatars.githubusercontent.com/u/2437969?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://avatars.githubusercontent.com/u/1483538?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://avatars.githubusercontent.com/u/6249643?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://avatars.githubusercontent.com/u/5603632?v=3&s=150\">\n <br />\n <a href=\"https://github.com/daltones\">Dalton Santos</a>\n </td>\n </tr>\n <tbody>\n</table>\n\n[npm]: https://img.shields.io/npm/v/postcss-load-config.svg\n[npm-url]: https://npmjs.com/package/postcss-load-config\n\n[node]: https://img.shields.io/node/v/postcss-load-plugins.svg\n[node-url]: https://nodejs.org/\n\n[deps]: https://david-dm.org/michael-ciniawsky/postcss-load-config.svg\n[deps-url]: https://david-dm.org/michael-ciniawsky/postcss-load-config\n\n[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg\n[style-url]: http://standardjs.com/\n\n[tests]: http://img.shields.io/travis/michael-ciniawsky/postcss-load-config.svg\n[tests-url]: https://travis-ci.org/michael-ciniawsky/postcss-load-config\n\n[cover]: https://coveralls.io/repos/github/michael-ciniawsky/postcss-load-config/badge.svg\n[cover-url]: https://coveralls.io/github/michael-ciniawsky/postcss-load-config\n\n[chat]: https://img.shields.io/gitter/room/postcss/postcss.svg\n[chat-url]: https://gitter.im/postcss/postcss\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/michael-ciniawsky/postcss-load-config.git"
},
"scripts": {
"clean": "rm -rf .nyc_output coverage jsdoc-api dmd",
"docs": "jsdoc2md index.js > INDEX.md",
"lint": "standard",
"logs": "standard-changelog -i CHANGELOG.md -w",
"start": "sudo npm run clean && npm run lint && sudo npm test",
"test": "nyc ava -v test/err/index.js test/pkg/index.js test/rc/index.js test/js/**/index.js"
},
"version": "1.2.0"
}