{"id":16891232,"url":"https://github.com/fz6m/lightningcss-loader","last_synced_at":"2025-04-05T18:08:51.263Z","repository":{"id":49746107,"uuid":"461598901","full_name":"fz6m/lightningcss-loader","owner":"fz6m","description":"Speed up your Webpack build with lightningcss (Original parcel-css-loader)","archived":false,"fork":false,"pushed_at":"2025-02-07T14:31:46.000Z","size":317,"stargazers_count":60,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T16:10:04.924Z","etag":null,"topics":["autoprefixer","lightningcss","parcel-css","postcss","webpack-css-minifier","webpack-loader"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fz6m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-20T19:49:45.000Z","updated_at":"2025-03-04T11:22:24.000Z","dependencies_parsed_at":"2022-09-09T02:03:04.133Z","dependency_job_id":null,"html_url":"https://github.com/fz6m/lightningcss-loader","commit_stats":null,"previous_names":["fz6m/parcel-css-loader"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fz6m%2Flightningcss-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fz6m%2Flightningcss-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fz6m%2Flightningcss-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fz6m%2Flightningcss-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fz6m","download_url":"https://codeload.github.com/fz6m/lightningcss-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378149,"owners_count":20929297,"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":["autoprefixer","lightningcss","parcel-css","postcss","webpack-css-minifier","webpack-loader"],"created_at":"2024-10-13T17:06:16.269Z","updated_at":"2025-04-05T18:08:51.243Z","avatar_url":"https://github.com/fz6m.png","language":"TypeScript","readme":"# lightningcss-loader\n\nSpeed up your Webpack build with [lightningcss](https://github.com/parcel-bundler/lightningcss)\n\n## Install\n\n```bash\n  pnpm add -D lightningcss-loader\n```\n\n## Usage\n\n### Optimize css\n\nwebpack config example:\n\n```js\n// webpack.config.js\nconst { LightningCssMinifyPlugin } = require('lightningcss-loader')\n\nmodule.exports = {\n  optimization: {\n    minimize: true,\n    minimizer: [\n      new LightningCssMinifyPlugin()\n    ]\n  },\n};\n```\n\n\n### Instead of postcss-loader\n\nwebpack config example:\n\n```diff\n// webpack.config.js\n\n// need install `lightningcss`\nconst LightningCSS = require('lightningcss')\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.scss$/,\n        use: [\n          'style-loader', // or MiniCssExtractPlugin.loader\n          'css-loader',\n-         'postcss-loader',\n+         {\n+           loader: 'lightningcss-loader',\n+           options: {\n+             implementation: LightningCSS\n+           }\n+         }\n          'sass-loader'\n        ],\n      },\n    ],\n  },\n};\n```\n\nlightningcss can replace `autoprefixer` and `postcss-preset-env`, if you use custom postcss plugins, you can use both `lightningcss-loader` and `postcss-loader`.\n\n## Config\n\n```js\n// webpack.config.js\nconst { LightningCssMinifyPlugin } = require('lightningcss-loader')\nconst LightningCSS = require('lightningcss')\n\nmodule.exports = {\n  optimization: {\n    minimizer: [\n      new LightningCssMinifyPlugin({\n        implementation: LightningCSS\n        // ... lightningcss options\n      })\n    ]\n  },\n};\n```\n\nYou can see type tips for detailed configurable items\n\n## Advanced\n\n### Custom media queries\n\n`lightningcss-loader` uses a heuristic methods to support `Custom media queries` syntax. \n\nMake sure the defined `@custom-media` file no other CSS. otherwise it may generate duplicate CSS and increase the bundle size.\n\n## Migration from `parcel-css-loader`\n\n1. Remove and install:\n\n    ```bash\n      pnpm remove parcel-css-loader @parcel/css\n      pnpm i -D lightningcss-loader lightningcss\n    ```\n\n2. Search code and replace to new name:\n\n    - `parcel-css-loader` -\u003e `lightningcss-loader`\n\n    - `ParcelCssMinifyPlugin` -\u003e `LightningCssMinifyPlugin`\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffz6m%2Flightningcss-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffz6m%2Flightningcss-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffz6m%2Flightningcss-loader/lists"}