{"id":17875322,"url":"https://github.com/noyobo/esbuild-style-loader","last_synced_at":"2025-03-21T23:33:02.542Z","repository":{"id":167146568,"uuid":"642714207","full_name":"noyobo/esbuild-style-loader","owner":"noyobo","description":"A style loader for esbuild, support for CSS, SCSS, LESS, Stylus, and CSS Modules.","archived":false,"fork":false,"pushed_at":"2024-09-16T08:39:22.000Z","size":678,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-22T19:47:30.014Z","etag":null,"topics":["esbuild","esbuild-css-modules","esbuild-loader","esbuild-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/noyobo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-05-19T07:25:18.000Z","updated_at":"2024-07-22T13:48:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd26d8c2-280d-4ea6-91bb-81bb3b9e7fe1","html_url":"https://github.com/noyobo/esbuild-style-loader","commit_stats":null,"previous_names":["noyobo/esbuild-style-loader"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noyobo%2Fesbuild-style-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noyobo%2Fesbuild-style-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noyobo%2Fesbuild-style-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noyobo%2Fesbuild-style-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noyobo","download_url":"https://codeload.github.com/noyobo/esbuild-style-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221820597,"owners_count":16886222,"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":["esbuild","esbuild-css-modules","esbuild-loader","esbuild-plugin"],"created_at":"2024-10-28T11:14:29.102Z","updated_at":"2024-10-28T11:14:29.661Z","avatar_url":"https://github.com/noyobo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esbuild-style-loader\n\n[![npm version](https://badge.fury.io/js/esbuild-style-loader.svg)](https://badge.fury.io/js/esbuild-style-loader)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![issues](https://img.shields.io/github/issues/noyobo/esbuild-style-loader.svg)](https://github.com/noyobo/esbuild-style-loader/issues)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)\n[![downloads](https://img.shields.io/npm/dm/esbuild-style-loader.svg)](https://www.npmjs.com/package/esbuild-style-loader)\n[![Code Coverage](https://codecov.io/gh/noyobo/esbuild-style-loader/branch/main/graph/badge.svg)](https://codecov.io/gh/noyobo/esbuild-style-loader)\n[![Node.js CI](https://github.com/noyobo/esbuild-style-loader/actions/workflows/node.js.yml/badge.svg)](https://github.com/noyobo/esbuild-style-loader/actions/workflows/node.js.yml)\n\nA style loader for esbuild, support for CSS, SCSS, LESS, Stylus, and CSS Modules.\n\n## Features\n\n- [x] Zero configuration\n- [x] Support for CSS Modules\n- [x] Support for LESS `builtin`\n- [x] Support for CSS\n- [x] Autoprefixer for CSS\n  - default: `ios \u003e= 11, android \u003e= 5, chrome \u003e= 54`\n- [x] Support sourceMap\n- [x] Fast compiler engine by [lightningcss](https://lightningcss.dev/)\n\n## Default behavior\n\nThe following rules enable css-modules\n\n1. The file name ends with `/.modules?\\.(css|less|scss|sass|styl)/`\n2. The file query contains `modules` or `modules=true`\n   - Can be used with plugins [esbuild-plugin-auto-css-modules](https://www.npmjs.com/package/esbuild-plugin-auto-css-modules)\n\n```ts\nimport styles from './style.css?modules';\nimport styles from './style.module.css';\nimport styles from './style.modules.css';\nimport styles from './style.less?modules';\nimport styles from './style.module.less';\nimport styles from './style.modules.less';\n```\n\nNormal CSS files are not treated as CSS Modules\n\n```ts\nimport './style.css';\nimport './style.less';\nimport styles from './style.css';\nimport styles from './style.less';\n```\n\n## Usage\n\n```ts\nimport { build } from 'esbuild';\nimport { styleLoader } from 'esbuild-style-loader';\n\nconst buildOptions = {\n  plugins: [\n    styleLoader({\n      filter: /\\.(css|less|scss|sass|tyss)(\\?.*)?$/,\n      /**\n       * Process file results from other plugins namespace\n       */\n      namespace: ['native-component', 'file'],\n      /**\n       * The browser setting for lightningcss\n       */\n      browsers: 'ios \u003e= 11, android \u003e= 5, chrome \u003e= 54',\n      cssModules: {\n        pattern: process.env.CI_TEST === 'test' ? '[name]__[local]' : '[local]__[hash]',\n      },\n      /**\n       * The public path for absolute paths in css\n       */\n      publicPath: __dirname,\n    }),\n  ],\n};\n```\n\nif you want to use absolute paths, you can specify the `publicPath` option\n\n## TODO\n\n- [ ] Support for Stylus\n- [ ] Support for Sass\n  - [x] [sass](https://www.npmjs.com/package/sass)\n  - [ ] [node-sass](https://www.npmjs.com/package/node-sass)\n  - [ ] [sass-embedded](https://www.npmjs.com/package/sass-embedded)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoyobo%2Fesbuild-style-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoyobo%2Fesbuild-style-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoyobo%2Fesbuild-style-loader/lists"}