{"_id":"@vusion/postcss-import","_rev":"10-a22f12f3b6def50b4d4093bce9636c18","name":"@vusion/postcss-import","dist-tags":{"latest":"12.0.1"},"versions":{"12.0.1":{"name":"@vusion/postcss-import","version":"12.0.1","keywords":["css","postcss","postcss-plugin","import","node modules","npm"],"author":{"name":"Rainfore","email":"rainforest92@126.com"},"license":"MIT","_id":"@vusion/postcss-import@12.0.1","maintainers":[{"name":"cxhtml","email":"lanhai723@126.com"},{"name":"shaoyuee","email":"13588317944@163.com"},{"name":"rainfore","email":"rainforest92@126.com"},{"name":"moujintao","email":"moujintaotest@163.com"},{"name":"zhangsanshi","email":"zhangsanshi5566@gmail.com"}],"homepage":"https://github.com/postcss/postcss-import#readme","bugs":{"url":"https://github.com/postcss/postcss-import/issues"},"dist":{"shasum":"3294f16646e19a69446b983bd2d71b360d8c62d4","tarball":"https://registry.npmjs.org/@vusion/postcss-import/-/postcss-import-12.0.1.tgz","fileCount":10,"integrity":"sha512-ey0ZpZ5RtfZBYQi/MDN09ou3TEAPC7bNNReu5ox0XTLat+3/xuG10PM9n73cwi3m6IMpmsucfdRWkihgLgzPrA==","signatures":[{"sig":"MEYCIQDgo3GnFs9rjzUM4gbTEMz9KMTdu9k4e4ycMIOEYxVOSwIhAKALNUp5wmiyYyLSKo8mSR83SLnd+jlYO8DYMqQseQuZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34301,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgu3sCRA9TVsSAnZWagAA5kEP/iWLU4uUua/lhbD3IEbo\nGa1RfSK6f52TEiCxEbwX+w8lY6PB4TkqtxCbSTrNEJPi4ZX9Ypm9UMqPpXCN\n0TB5yfS4Xh4RFKlt0Jam1EFqH55rueyfMXyXWXHZlsjxEOXsTBo03aCyck2p\nC+IY6oXv0tOhieV2h8QbzjHY4YdTnWGFT/cU/BMKHTXahqpflAHdJ9Uzy7SB\nlAcLjep6gDLdzJEZHwurgj+MiEDe7hi/bZVARsgJqMpJPL9pXZNHL0Y6waXY\n87WNaTRgGbFk4N2PYHfSIer2rYkjuPPMYL0pOzUYQosB20sRXMKwgfsPOmf0\ntnFZq9r9wGgTonSnMVYQ7f+jBJmfc0Qwan5qDaNm2O/+uwc5Ncqsn7lBTWRW\nSgKBIhsB/PHaTREYcFW+sMf1Aqj4/sBraKDCZ6K90EgrO9ARMNbA4UpA5WUd\nuhha9PtzELslP1ZCTpuNCkLWll5sH7vigwPyD8o6D7kSKFD7q/bd2iQdp542\n7Qk/6GhfaoFHyqX1bnPVCCo8muBZlhNZuvCdI12lyOJFKZgoIHV0h35nxncF\nACieMiQ3cJJ4Fw9vhP8Juwx3hxDOZmBkRJr6Qbxe3Mq1EU0pWIhrhkXpsiay\no9sHrtxWuqanF4SYwv25OAMvQ28h4L8ATMXh5p3ef4LFYW4V1M/QmVMQJO1y\nTbr6\r\n=uUUB\r\n-----END PGP SIGNATURE-----\r\n"},"engines":{"node":">=6.0.0"},"gitHead":"2da2ce2c4191fd3caaacc043789f4935f19bee75","scripts":{"ci":"eslint . && ava","lint":"eslint . --fix","test":"ava","pretest":"npm run lint"},"_npmUser":{"name":"rainfore","email":"rainforest92@126.com"},"repository":{"url":"git+https://github.com/postcss/postcss-import.git","type":"git"},"_npmVersion":"6.9.0","description":"PostCSS plugin to import CSS files","directories":{},"_nodeVersion":"10.16.3","dependencies":{"postcss":"^7.0.1","resolve":"^1.1.7","read-cache":"^1.0.0","postcss-value-parser":"^3.2.3"},"eslintConfig":{"rules":{"prettier/prettier":["error",{"semi":false,"trailingComma":"es5"}]},"extends":"eslint-config-i-am-meticulous","plugins":["prettier"]},"_hasShrinkwrap":false,"devDependencies":{"ava":"^1.0.1","eslint":"^5.0.0","sugarss":"^2.0.0","prettier":"~1.18.0","postcss-scss":"^2.0.0","eslint-plugin-import":"^2.17.1","eslint-plugin-prettier":"^3.0.0","eslint-config-i-am-meticulous":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/postcss-import_12.0.1_1568861676293_0.9401352452752718","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-09-19T02:54:36.085Z","modified":"2025-04-15T02:57:08.680Z","12.0.1":"2019-09-19T02:54:36.465Z"},"bugs":{"url":"https://github.com/postcss/postcss-import/issues"},"author":{"name":"Rainfore","email":"rainforest92@126.com"},"license":"MIT","homepage":"https://github.com/postcss/postcss-import#readme","keywords":["css","postcss","postcss-plugin","import","node modules","npm"],"repository":{"url":"git+https://github.com/postcss/postcss-import.git","type":"git"},"description":"PostCSS plugin to import CSS files","maintainers":[{"email":"rainforest92@126.com","name":"rainfore"},{"email":"wddpwzz36@gmail.com","name":"lip966"},{"email":"13588254504@163.com","name":"linghaha"}],"readme":"- Remove this rule: **This plugin attempts to follow the CSS `@import` spec**; `@import`\n  statements must precede all other statements (besides `@charset`).\n\n# postcss-import\n\n[![Unix Build status](https://img.shields.io/travis/postcss/postcss-import/master.svg?branch=master&label=unix%20build)](https://travis-ci.org/postcss/postcss-import)\n[![Windows Build status](https://img.shields.io/appveyor/ci/MoOx/postcss-import/master.svg?label=window%20build)](https://ci.appveyor.com/project/MoOx/postcss-import/branch/master)\n[![Version](https://img.shields.io/npm/v/postcss-import.svg)](https://github.com/postcss/postcss-import/blob/master/CHANGELOG.md)\n[![Greenkeeper badge](https://badges.greenkeeper.io/postcss/postcss-import.svg)](https://greenkeeper.io/)\n\n\n> [PostCSS](https://github.com/postcss/postcss) plugin to transform `@import`\nrules by inlining content.\n\nThis plugin can consume local files, node modules or web_modules.\nTo resolve path of an `@import` rule, it can look into root directory\n(by default `process.cwd()`), `web_modules`, `node_modules`\nor local modules.\n_When importing a module, it will look for `index.css` or file referenced in\n`package.json` in the `style` or `main` fields._\nYou can also provide manually multiples paths where to look at.\n\n**Notes:**\n\n- **This plugin should probably be used as the first plugin of your list.\nThis way, other plugins will work on the AST as if there were only a single file\nto process, and will probably work as you can expect**.\n- This plugin works great with\n[postcss-url](https://github.com/postcss/postcss-url) plugin,\nwhich will allow you to adjust assets `url()` (or even inline them) after\ninlining imported files.\n- In order to optimize output, **this plugin will only import a file once** on\na given scope (root, media query...).\nTests are made from the path & the content of imported files (using a hash\ntable).\nIf this behavior is not what you want, look at `skipDuplicates` option\n- **If you are looking for glob, or sass like imports (prefixed partials)**,\nplease look at\n[postcss-easy-import](https://github.com/trysound/postcss-easy-import)\n(which use this plugin under the hood).\n- Imports which are not modified (by `options.filter` or because they are remote\n  imports) are moved to the top of the output.\n\n## Installation\n\n```console\n$ npm install postcss-import\n```\n\n## Usage\n\nUnless your stylesheet is in the same place where you run postcss\n(`process.cwd()`), you will need to use `from` option to make relative imports\nwork.\n\n```js\n// dependencies\nvar fs = require(\"fs\")\nvar postcss = require(\"postcss\")\nvar atImport = require(\"postcss-import\")\n\n// css to be processed\nvar css = fs.readFileSync(\"css/input.css\", \"utf8\")\n\n// process css\npostcss()\n  .use(atImport())\n  .process(css, {\n    // `from` option is needed here\n    from: \"css/input.css\"\n  })\n  .then(function (result) {\n    var output = result.css\n\n    console.log(output)\n  })\n```\n\n`css/input.css`:\n\n```css\n/* can consume `node_modules`, `web_modules` or local modules */\n@import \"cssrecipes-defaults\"; /* == @import \"../node_modules/cssrecipes-defaults/index.css\"; */\n@import \"normalize.css\"; /* == @import \"../node_modules/normalize.css/normalize.css\"; */\n\n@import \"foo.css\"; /* relative to css/ according to `from` option above */\n\n@import \"bar.css\" (min-width: 25em);\n\nbody {\n  background: black;\n}\n```\n\nwill give you:\n\n```css\n/* ... content of ../node_modules/cssrecipes-defaults/index.css */\n/* ... content of ../node_modules/normalize.css/normalize.css */\n\n/* ... content of css/foo.css */\n\n@media (min-width: 25em) {\n/* ... content of css/bar.css */\n}\n\nbody {\n  background: black;\n}\n```\n\nCheckout the [tests](test) for more examples.\n\n### Options\n\n### `filter`\nType: `Function`\nDefault: `() => true`\n\nOnly transform imports for which the test function returns `true`. Imports for\nwhich the test function returns `false` will be left as is. The function gets\nthe path to import as an argument and should return a boolean.\n\n#### `root`\n\nType: `String`\nDefault: `process.cwd()` or _dirname of\n[the postcss `from`](https://github.com/postcss/postcss#node-source)_\n\nDefine the root where to resolve path (eg: place where `node_modules` are).\nShould not be used that much.\n_Note: nested `@import` will additionally benefit of the relative dirname of\nimported files._\n\n#### `path`\n\nType: `String|Array`\nDefault: `[]`\n\nA string or an array of paths in where to look for files.\n\n#### `plugins`\n\nType: `Array`\nDefault: `undefined`\n\nAn array of plugins to be applied on each imported files.\n\n#### `resolve`\n\nType: `Function`\nDefault: `null`\n\nYou can provide a custom path resolver with this option. This function gets\n`(id, basedir, importOptions)` arguments and should return a path, an array of\npaths or a promise resolving to the path(s). If you do not return an absolute\npath, your path will be resolved to an absolute path using the default\nresolver.\nYou can use [resolve](https://github.com/substack/node-resolve) for this.\n\n#### `load`\n\nType: `Function`\nDefault: null\n\nYou can overwrite the default loading way by setting this option.\nThis function gets `(filename, importOptions)` arguments and returns content or\npromised content.\n\n#### `skipDuplicates`\n\nType: `Boolean`\nDefault: `true`\n\nBy default, similar files (based on the same content) are being skipped.\nIt's to optimize output and skip similar files like `normalize.css` for example.\nIf this behavior is not what you want, just set this option to `false` to\ndisable it.\n\n#### `addModulesDirectories`\n\nType: `Array`\nDefault: `[]`\n\nAn array of folder names to add to [Node's resolver](https://github.com/substack/node-resolve).\nValues will be appended to the default resolve directories:\n`[\"node_modules\", \"web_modules\"]`.\n\nThis option is only for adding additional directories to default resolver. If\nyou provide your own resolver via the `resolve` configuration option above, then\nthis value will be ignored.\n\n#### Example with some options\n\n```js\nvar postcss = require(\"postcss\")\nvar atImport = require(\"postcss-import\")\n\npostcss()\n  .use(atImport({\n    path: [\"src/css\"],\n  }))\n  .process(cssString)\n  .then(function (result) {\n    var css = result.css\n  })\n```\n\n## `dependency` Message Support\n\n`postcss-import` adds a message to `result.messages` for each `@import`. Messages are in the following format:\n\n```\n{\n  type: 'dependency',\n  file: absoluteFilePath,\n  parent: fileContainingTheImport\n}\n```\n\nThis is mainly for use by postcss runners that implement file watching.\n\n---\n\n## CONTRIBUTING\n\n* ⇄ Pull requests and ★ Stars are always welcome.\n* For bugs and feature requests, please create an issue.\n* Pull requests must be accompanied by passing automated tests (`$ npm test`).\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n","readmeFilename":"README.md"}