{"id":15551370,"url":"https://github.com/webpack-config/webpack-config-css","last_synced_at":"2025-04-23T19:25:31.954Z","repository":{"id":143928178,"uuid":"83096571","full_name":"webpack-config/webpack-config-css","owner":"webpack-config","description":"A curated CSS loader config for Webpack with CSS Modules, PostCSS, and JS styles. ","archived":false,"fork":false,"pushed_at":"2018-03-01T21:51:49.000Z","size":37,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-23T19:25:18.936Z","etag":null,"topics":["css-in-js","postcss","webpack","webpack2"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpack-config.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-25T01:15:58.000Z","updated_at":"2019-03-27T09:04:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"e11f6e90-6a20-44cf-b23e-d24de5025534","html_url":"https://github.com/webpack-config/webpack-config-css","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-config%2Fwebpack-config-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpack-config","download_url":"https://codeload.github.com/webpack-config/webpack-config-css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250498386,"owners_count":21440456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css-in-js","postcss","webpack","webpack2"],"created_at":"2024-10-02T14:04:38.735Z","updated_at":"2025-04-23T19:25:31.948Z","avatar_url":"https://github.com/webpack-config.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#webpack-config-css\n\nA curated CSS loader config for [Webpack] with [CSS Modules], [PostCSS], and [JS styles]. \n\n[![build status](http://img.shields.io/travis/webpack-config/webpack-config-css/master.svg?style=flat)](https://travis-ci.org/webpack-config/webpack-config-css)\n[![coverage](http://img.shields.io/coveralls/webpack-config/webpack-config-css/master.svg?style=flat)](https://coveralls.io/github/webpack-config/webpack-config-css?branch=master)\n[![license](http://img.shields.io/npm/l/webpack-config-css.svg?style=flat)](https://www.npmjs.com/package/webpack-config-css)\n[![version](http://img.shields.io/npm/v/webpack-config-css.svg?style=flat)](https://www.npmjs.com/package/webpack-config-css)\n[![downloads](http://img.shields.io/npm/dm/webpack-config-css.svg?style=flat)](https://www.npmjs.com/package/webpack-config-css)\n\n## Usage\n\nInstall:\n\n```sh\nyarn add webpack-config-css\n```\n\nAdd to your `webpack.config.babel.js`:\n\n```js\nimport css from `webpack-config-css`;\n\ncss({/* options */})({\n  /* existing webpack configuration */\n})\n```\n\n### Options\n\n|Name|Default|Description|\n|:---|:------|:----------|\n|**`extract`**|`NODE_ENV` === `production`|Enable/Disable [Extract Text Plugin]|\n|**`modules`**|`true`|Enable/Disable [CSS Modules]|\n|**`minimize`**|`NODE_ENV` === `production`|Enable/Disable [minification]|\n|**`jsStyles`**|`true`|Enable/Disable support for [JS styles]|\n|**`postcss`**|`true`|Enable/Disable [PostCSS]|\n\nAny additional properties of the options object are forwarded to [CSS Loader].\n\n## Features\n\n`webpack-config-css` comes with optimal default settings and requires zero additional config out of the box. However all of the included features are fully full configurable through the options argument.\n\n### CSS Modules\n\nLocally scoped CSS is enable by default using [CSS Modules]. Set `modules: false` in the options to disable this and restore traditional global CSS selectors.\n\n### PostCSS\n\nPostCSS (with [`autoprefixer`] and [`postcss-nesting`]) is enabled by default. Set `postcss: false` in the options to disable it.\n\nTo use a custom PostCSS config, pass a config object as `postcss` in the options or include a `postcss.config.js` (or equivalent) in your project root or in `config/postcss/`.\n\n### Static CSS Output\n\nExtract Text Plugin is enabled by default when `NODE_ENV` is `production`. It can be disabled by setting `extract: false` in the options.\n\nTo change the extracted file name or to further configure the plugin, pass a plugin constructor object as `extract` in the options.\n\n### JS Styles\n\nSupport for styles written in JS is enabled by default using [`css-js-loader`]. CSS styles can be loaded from `css.js` files alongside regular `.css` files. \n\nA `.js.css` file:\n\n```js\nexport const className = {\n  color: 'red',\n  fontSize: 24,\n};\n```\n\nYields:\n\n```css\n.className {\n  color: red;\n  font-size: 24px;\n};\n```\n\nTo support JS styles written in ES6, [`babel-loader`] must be configured to load the `.css.js` files _before_ `webpack-config-css` in your webpack config:\n\n```js\nimport flow from 'lodash/fp/flow'\nimport {loader} from 'webpack-partial';\nimport css from `webpack-config-css`;\n\nexport default flow(\n  loader({\n    test: /\\.js$/,\n    exclude: /node_modules/,\n    loader: require.resolve('babel-loader'),\n  }),\n  css(),\n)({\n  /* existing webpack configuration */\n})\n```\n\nTo disable JS styles, pass `jsStyles: false` in the options.\n\n[webpack]: https://webpack.github.io\n[Extract Text Plugin]: https://github.com/webpack-contrib/extract-text-webpack-plugin\n[CSS Loader]: https://github.com/webpack-contrib/css-loader\n[JS styles]: https://github.com/10xjs/css-js-loader\n[CSS Modules]: https://github.com/webpack-contrib/css-loader#css-modules\n[minification]: https://github.com/webpack-contrib/css-loader#minification\n[PostCSS]: https://github.com/postcss/postcss\n[`css-js-loader`]: https://github.com/10xjs/css-js-loader\n[`autoprefixer`]: https://github.com/postcss/autoprefixer\n[`postcss-nesting`]: https://github.com/jonathantneal/postcss-nesting\n[`babel-loader`]: https://github.com/babel/babel-loader\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack-config%2Fwebpack-config-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpack-config%2Fwebpack-config-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack-config%2Fwebpack-config-css/lists"}