{"name":"webpack-handle-css-loader","version":"2.0.0","description":"A little helper module for adding CSS and CSS extraction support in webpack.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/egoist/webpack-handle-css-loader.git"},"author":{"name":"EGOIST","email":"0x142857@gmail.com","url":"github.com/egoist"},"engines":{"node":">=4"},"scripts":{"test":"jest && xo && npm run build","build":"bili --name index","docs":"documentation readme src/index.js -s API"},"files":["dist"],"main":"dist/index.common.js","keywords":["css-loader","webpack"],"devDependencies":{"babel-preset-env":"^1.4.0","babel-preset-stage-2":"^6.24.1","bili":"^0.14.2","documentation":"^4.0.0-rc.1","eslint-config-rem":"^3.0.1","extract-text-webpack-plugin":"^2.1.0","jest-cli":"^19.0.2","webpack":"^2.4.1","xo":"^0.18.1"},"jest":{"testEnvironment":"node"},"xo":{"extends":"rem","envs":["jest"]},"peerDependencies":{"extract-text-webpack-plugin":"*"},"gitHead":"b84061f6196a6dc74b1564cb4ad4b2fdfe830a9e","bugs":{"url":"https://github.com/egoist/webpack-handle-css-loader/issues"},"homepage":"https://github.com/egoist/webpack-handle-css-loader#readme","_id":"webpack-handle-css-loader@2.0.0","_shasum":"552500118c19006c4148b003cc9b01e7049517fa","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.6.0","_npmUser":{"name":"rem","email":"0x142857@gmail.com"},"dist":{"shasum":"552500118c19006c4148b003cc9b01e7049517fa","tarball":"http://registry-npm.ywwl.com/webpack-handle-css-loader/download/webpack-handle-css-loader-2.0.0.tgz","integrity":"sha512-t4wA2q7ltMv31oTIUFek4nsj8dlgIn3muByeDcpFTF76fYH9SmnW00uzF8kMn43XyAU/y2vBOQ5/I79qxUDECQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCr+svj7MM4amKr8NiBoSKbha1u2sc5uiotOdL1+fco9AIgfHTaFStMbUVOF1o6e/xe+8FZw7Yizo7GPPcI0zXFWYg="}],"size":4195,"noattachment":false,"key":"/webpack-handle-css-loader/-/webpack-handle-css-loader-2.0.0.tgz"},"maintainers":[{"name":"rem","email":"0x142857@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/webpack-handle-css-loader-2.0.0.tgz_1495285130461_0.47522767167538404"},"directories":{},"readme":"# webpack-handle-css-loader\n\n[![NPM version](https://img.shields.io/npm/v/webpack-handle-css-loader.svg?style=flat-square)](https://npmjs.com/package/webpack-handle-css-loader) [![NPM downloads](https://img.shields.io/npm/dm/webpack-handle-css-loader.svg?style=flat-square)](https://npmjs.com/package/webpack-handle-css-loader) [![Build Status](https://img.shields.io/circleci/project/egoist/webpack-handle-css-loader/master.svg?style=flat-square)](https://circleci.com/gh/egoist/webpack-handle-css-loader) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat-square)](https://github.com/egoist/donate)\n\nThis is a short-hand module for adding css and extracting css support.\n\n## Install\n\n```bash\nyarn add webpack-handle-css-loader\n\n# If you want to extract CSS\n# Install this plugin as well\nyarn add mini-css-extract-plugin\n```\n\n## Usage\n\n```js\nconst HandleCSSLoader = require('webpack-handle-css-loader')\nconst MiniCssExtractPlugin = require('mini-css-extract-plugin')\n\nconst isProd = process.env.NODE_ENV === 'production'\n\nconst handleLoader = new HandleCSSLoader({\n  minimize: isProd,\n  extract: isProd,\n  sourceMap: false,\n  cssModules: false\n})\n\nmodule.exports = {\n  module: {\n    rules: [\n      // Handle .css files with css-loader & postcss-loader\n      handleLoader.css(),\n      // Handle .sass files\n      // Similar to above but add sass-loader too\n      handleLoader.sass()\n    ]\n  },\n  plugins: [\n    isProd && new MiniCssExtractPlugin({\n      // Options similar to the same options in webpackOptions.output\n      // both options are optional\n      filename: \"[name].css\",\n      chunkFilename: \"[id].css\"\n    })\n  ].filter(Boolean)\n}\n```\n\n> **Note:**\n>\n> We add `postcss-loader` to each rule, which means in `handleLoader.css()` you got something like `['style-loader', 'css-loader', 'postcss-loader']`, see [here](#constructor) for how to disable it or set options for it.\n\n## API\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n### constructor\n\n**Parameters**\n\n-   `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n    -   `options.styleLoader` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** style-loader name or path. (optional, default `'style-loader'`)\n    -   `options.cssLoader` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** css-loader name or path. (optional, default `'css-loader'`)\n    -   `options.postcss` **([Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \\| [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean))** Disable or set options for  postcss-loader. (optional, default `undefined`)\n    -   `options.sourceMap` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Enable sourcemaps. (optional, default `undefined`)\n    -   `options.extract` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Enable CSS extraction. (optional, default `undefined`)\n    -   `options.minimize` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Enable CSS minimization. (optional, default `undefined`)\n    -   `options.cssModules` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Enable CSS modules. (optional, default `undefined`)\n    -   `options.extractLoader` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** loader path of mini-css-extract-plugin. (optional, default `'mini-css-extract-plugin/dist/loader'`)\n\n### set\n\nSet value of instance option\n\n**Parameters**\n\n-   `key` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** \n-   `value` **any** \n\n### getLoader\n\nGet the rule for specific loader\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `undefined`)\n-   `loader` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** Loader name or path to it (optional, default `undefined`)\n-   `options` **any** Options for relevant loader (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### css\n\nGet the rule for css files\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `/\\.css$/`)\n-   `options` **any** Options for css-loader (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### sass\n\nGet the rule for sass files\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `/\\.sass$/`)\n-   `options` **any** Options for sass-loader, `indentedSyntax` for sass-loader is `true` here (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### scss\n\nGet the rule for scss files\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `/\\.scss$/`)\n-   `options` **any** Options for sass-loader (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### less\n\nGet the rule for less files\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `/\\.less$/`)\n-   `options` **any** Options for less-loader (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [Rule] [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### stylus\n\nGet the rule for stylus files\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `/\\.stylus$/`)\n-   `options` **any** Options for stylus-loader (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### styl\n\nGet the rule for styl files\n\n**Parameters**\n\n-   `test` **[RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp)** File matcher (optional, default `/\\.styl$/`)\n-   `options` **any** Options for stylus-loader (optional, default `undefined`)\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [webpack Rule](https://webpack.js.org/configuration/module/#rule)\n\n### vue\n\nGet the `loaders` options for vue-loader\n\n**Parameters**\n\n-   `options` **any** Options for relevant loaders (optional, default `{}`)\n\n**Examples**\n\n```javascript\nhandleLoader.vue({\n scss: {},\n less: {}\n})\n```\n\nReturns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** \n\n## Contributing\n\n1.  Fork it!\n2.  Create your feature branch: `git checkout -b my-new-feature`\n3.  Commit your changes: `git commit -am 'Add some feature'`\n4.  Push to the branch: `git push origin my-new-feature`\n5.  Submit a pull request :D\n\n## Author\n\n**webpack-handle-css-loader** © [EGOIST](https://github.com/egoist), Released under the [MIT](https://egoist.mit-license.org/) License.<br>\nAuthored and maintained by EGOIST with help from contributors ([list](https://github.com/egoist/webpack-handle-css-loader/contributors)).\n\n> [egoist.moe](https://egoist.moe) · GitHub [@egoist](https://github.com/egoist) · Twitter [@\\_egoistlily](https://twitter.com/_egoistlily)\n","publish_time":1495285130624,"_cnpm_publish_time":1495285130624,"dist-tags":{"latest":"3.0.1"}}