{"_id":"rollup-plugin-postcss-umi","_rev":"2819339","name":"rollup-plugin-postcss-umi","description":"Seamless integration between Rollup and PostCSS","dist-tags":{"latest":"2.0.3"},"maintainers":[{"name":"sorrycc","email":""}],"time":{"modified":"2022-09-06T14:13:05.000Z","created":"2019-03-01T03:39:35.632Z","2.0.3":"2019-03-01T03:39:35.632Z"},"users":{},"author":{"name":"EGOIST","email":"0x142857@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/egoist/rollup-plugin-postcss-umi.git"},"versions":{"2.0.3":{"name":"rollup-plugin-postcss-umi","version":"2.0.3","description":"Seamless integration between Rollup and PostCSS","main":"dist/index.js","scripts":{"test":"npm run lint && jest","test:cov":"npm run lint && jest --coverage","build":"bili","lint":"xo","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/egoist/rollup-plugin-postcss-umi.git"},"keywords":["postcss","rollup"],"author":{"name":"EGOIST","email":"0x142857@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/egoist/rollup-plugin-postcss-umi/issues"},"engines":{"node":">=6"},"homepage":"https://github.com/egoist/rollup-plugin-postcss-umi#readme","devDependencies":{"@babel/core":"^7.2.2","autoprefixer":"^7.2.4","babel-core":"^7.0.0-bridge.0","babel-jest":"^23.6.0","bili":"^4.2.4","eslint-config-rem":"^4.0.0","fs-extra":"^7.0.1","jest":"^23.6.0","less":"^2.7.3","node-sass":"^4.7.2","rollup":"^1.1.2","stylus":"^0.54.5","sugarss":"^1.0.1","xo":"^0.18.2"},"dependencies":{"chalk":"^2.4.2","concat-with-sourcemaps":"^1.0.5","cssnano":"^4.1.8","import-cwd":"^2.1.0","p-queue":"^2.4.2","pify":"^3.0.0","postcss":"^7.0.14","postcss-load-config":"^2.0.0","postcss-modules":"^1.4.1","promise.series":"^0.2.0","reserved-words":"^0.1.2","resolve":"^1.5.0","rollup-pluginutils":"^2.0.1","style-inject":"^0.3.0"},"xo":{"extends":"rem","envs":["jest"],"rules":{"import/prefer-default-export":0}},"jest":{"testEnvironment":"node"},"babel":{"presets":[["@babel/preset-env",{"targets":{"node":"6"}}]]},"gitHead":"1b40e102ff668b6bf6b41aa71dadf6507944c379","_id":"rollup-plugin-postcss-umi@2.0.3","_nodeVersion":"10.13.0","_npmVersion":"6.8.0","dist":{"shasum":"8c7fb0afad2a2ad58c12a977a630b4eee307f56d","size":12705,"noattachment":false,"key":"/rollup-plugin-postcss-umi/-/rollup-plugin-postcss-umi-2.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/rollup-plugin-postcss-umi/download/rollup-plugin-postcss-umi-2.0.3.tgz"},"maintainers":[{"name":"sorrycc","email":""}],"_npmUser":{"name":"sorrycc","email":"sorrycc@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rollup-plugin-postcss-umi_2.0.3_1551411575499_0.6474199655929744"},"_hasShrinkwrap":false,"publish_time":1551411575632,"_cnpm_publish_time":1551411575632,"_cnpmcore_publish_time":"2021-12-16T11:32:04.583Z"}},"readme":"# rollup-plugin-postcss-umi\n\n[![NPM version](https://img.shields.io/npm/v/rollup-plugin-postcss-umi.svg?style=flat)](https://npmjs.com/package/rollup-plugin-postcss-umi) [![NPM downloads](https://img.shields.io/npm/dm/rollup-plugin-postcss-umi.svg?style=flat)](https://npmjs.com/package/rollup-plugin-postcss-umi) [![Build Status](https://img.shields.io/circleci/project/egoist/rollup-plugin-postcss-umi/master.svg?style=flat)](https://circleci.com/gh/egoist/rollup-plugin-postcss-umi) [![codecov](https://codecov.io/gh/egoist/rollup-plugin-postcss-umi/branch/master/graph/badge.svg)](https://codecov.io/gh/egoist/rollup-plugin-postcss-umi)\n [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate)\n\n<img align=\"right\" width=\"95\" height=\"95\"\n     title=\"Philosopher’s stone, logo of PostCSS\"\n     src=\"http://postcss.github.io/postcss/logo.svg\">\n\nSeamless integration between [Rollup](https://github.com/rollup/rollup) and [PostCSS](https://github.com/postcss/postcss).\n\n## Install\n\n```bash\nyarn add rollup-plugin-postcss-umi --dev\n```\n\n## Usage\n\nYou are viewing the docs for `v2.0` which only support Rollup 1.0 or above.\n```js\n// rollup.config.js\nimport postcss from 'rollup-plugin-postcss-umi'\n\nexport default {\n  plugins: [\n    postcss({\n      plugins: []\n    })\n  ]\n}\n```\n\nThen you can use CSS files:\n\n```js\nimport './style.css'\n```\n\nNote that the generated CSS will be injected to `<head>` by default, and the CSS string is also available as default export unless `extract: true`:\n\n```js\n// Inject to `<head>` and also available as `style`\nimport style from './style.css'\n```\n\nIt will also automatically use local PostCSS config files.\n\n### Extract CSS\n\n```js\npostcss({\n  extract: true\n})\n```\n\n### CSS modules\n\n```js\npostcss({\n  modules: true,\n  // Or with custom options for `postcss-modules`\n  modules: {}\n})\n```\n\n### With Sass/Stylus/Less\n\nInstall corresponding dependency:\n\n- For `Sass` install `node-sass`: `yarn add node-sass --dev`\n- For `Stylus` Install `stylus`: `yarn add stylus --dev`\n- For `Less` Install `less`: `yarn add less --dev`\n\nThat's it, you can now import `.styl` `.scss` `.sass` `.less` files in your library.\n\n#### imports\n\n__For Sass/Scss Only.__\n\nSimilar to how webpack's [sass-loader](https://github.com/webpack-contrib/sass-loader#imports) works, you can prepend the path with `~` to tell this plugin to resolve in `node_modules`:\n\n```sass\n@import \"~bootstrap/dist/css/bootstrap\";\n```\n\n## Options\n\n### extensions\n\nType: `string[]`<br>\nDefault: `['.css', '.sss', '.pcss']`\n\nThis plugin will process files ending with these extensions and the extensions supported by [custom loaders](#loaders).\n\n### plugins\n\nType: `Array`\n\nPostCSS Plugins.\n\n### inject\n\nType: `boolean` `object`<br>\nDefault: `true`\n\nInject CSS into `<head>`, it's always `false` when `extract: true`.\n\nYou can also use it as options for [`style-inject`](https://github.com/egoist/style-inject#options).\n\n### extract\n\nType: `boolean` `string`<br>\nDefault: `false`\n\nExtract CSS to the same location where JS file is generated but with `.css` extension.\n\nYou can also set it to an absolute path.\n\n### modules\n\nType: `boolean` `object`<br>\nDefault: `false`\n\nEnable CSS modules or set options for `postcss-modules`.\n\n### autoModules\n\nType: `boolean`<br>\nDefault: `true`\n\nAutomatically enable CSS modules for `.module.css` `.module.sss` `.module.scss` `.module.sass` `.module.styl` `.module.stylus` `.module.less` files.\n\n### namedExports\n\nType: `boolean` `function`<br>\nDefault: `false`\n\nUse named exports alongside default export.\n\nYou can supply a function to control how exported named is generated:\n\n```js\nnamedExports(name) {\n  // Maybe you simply want to convert dash to underscore\n  return name.replace(/-/g, '_')\n}\n```\n\nIf you set it to `true`, the following will happen when importing specific classNames:\n\n- dashed class names will be transformed by replacing all the dashes to `$` sign wrapped underlines, eg. `--` => `$__$`\n- js protected names used as your style class names, will be transformed by wrapping the names between `$` signs, eg. `switch` => `$switch$`\n\nAll transformed names will be logged in your terminal like:\n\n```bash\nExported \"new\" as \"$new$\" in test/fixtures/named-exports/style.css\n```\n\nThe original will not be removed, it's still available on `default` export:\n\n```js\nimport style, { class$_$name, class$__$name, $switch$ } from './style.css'\nconsole.log(style['class-name'] === class$_$name) // true\nconsole.log(style['class--name'] === class$__$name) // true\nconsole.log(style['switch'] === $switch$) // true\n```\n\n### minimize\n\nType: `boolean` `object`<br>\nDefault: `false`\n\nMinimize CSS, `boolean` or options for `cssnano`.\n\n### sourceMap\n\nType: `boolean` `\"inline\"`\n\nEnable sourceMap.\n\n### parser\n\nType: `string` `function`\n\nPostCSS parser, like `sugarss`.\n\n### stringifier\n\nType: `string` `function`\n\nPostCSS Stringifier.\n\n### syntax\n\nType: `string` `function`\n\nPostCSS Syntax.\n\n### exec\n\nType: `boolean`\n\nEnable PostCSS Parser support in `CSS-in-JS`.\n\n### config\n\nType: `boolean` `object`<br>\nDefault: `true`\n\nLoad PostCSS config file.\n\n#### config.path\n\nType: `string`\n\nThe path to config file, so that we can skip searching.\n\n#### config.ctx\n\nType: `object`\n\n[`ctx`](https://github.com/michael-ciniawsky/postcss-load-config#context) argument for PostCSS config file.\n\nNote: Every keys you pass to `config.ctx` will be available under `options` inside\nthe postcss config.\n\n```js\n// rollup.config.js\npostcss({\n  config: {\n    ctx: {\n      foo: 'bar'\n    }\n  }\n})\n\n// postcss.config.js\nmodule.exports = context => {\n  console.log(context.options.foo) // 'bar'\n\n  return {}\n}\n```\n\n### use\n\nType: `name[]` `[name, options][]`<br>\nDefault: `['sass', 'stylus', 'less']`\n\nUse a loader, currently built-in loaders are:\n\n- `sass` (Support `.scss` and `.sass`)\n- `stylus` (Support `.styl` and `.stylus`)\n- `less` (Support `.less`)\n\nThey are executed from right to left.\n\n### loaders\n\nType: `Loader[]`\n\nAn array of custom loaders, check out our [sass-loader](./src/sass-loader.js) as example.\n\n```js\ninterface Loader {\n  name: string,\n  test: RegExp,\n  process: (this: Context, input: Payload) => Promise<Payload> | Payload\n}\n\ninterface Context {\n  /** Loader options */\n  options: any\n  /** Sourcemap */\n  sourceMap: any\n  /** Resource path */\n  id: string\n  /** Files to watch */\n  dependencies: Set<string>\n  /** Emit a waring */\n  warn: PluginContext.warn\n  /** https://rollupjs.org/guide/en#plugin-context */\n  plugin: PluginContext\n}\n\ninterface Payload {\n  /** File content */\n  code: string\n  /** Sourcemap */\n  map?: string | SourceMap\n}\n```\n\n### onImport\n\nType: `id => void`\n\nA function to be invoked when an import for CSS file is detected.\n\n## License\n\nMIT &copy; [EGOIST](https://github.com/egoist)\n","_attachments":{},"homepage":"https://github.com/egoist/rollup-plugin-postcss-umi#readme","bugs":{"url":"https://github.com/egoist/rollup-plugin-postcss-umi/issues"},"license":"MIT"}