0.3.4 • Published 6 months ago
esbuild-style-loader v0.3.4
esbuild-style-loader
A style loader for esbuild, support for CSS, SCSS, LESS, Stylus, and CSS Modules.
Features
- Zero configuration
- Support for CSS Modules
- Support for LESS
builtin
- Support for CSS
- Autoprefixer for CSS
- default:
ios >= 11, android >= 5, chrome >= 54
- default:
- Support sourceMap
- Fast compiler engine by lightningcss
Default behavior
The following rules enable css-modules
- The file name ends with
/.modules?\.(css|less|scss|sass|styl)/
- The file query contains
modules
ormodules=true
- Can be used with plugins esbuild-plugin-auto-css-modules
import styles from './style.css?modules';
import styles from './style.module.css';
import styles from './style.modules.css';
import styles from './style.less?modules';
import styles from './style.module.less';
import styles from './style.modules.less';
Normal CSS files are not treated as CSS Modules
import './style.css';
import './style.less';
import styles from './style.css';
import styles from './style.less';
Usage
import { build } from 'esbuild';
import { styleLoader } from 'esbuild-style-loader';
const buildOptions = {
plugins: [
styleLoader({
filter: /\.(css|less|scss|sass|tyss)(\?.*)?$/,
/**
* Process file results from other plugins namespace
*/
namespace: ['native-component', 'file'],
/**
* The browser setting for lightningcss
*/
browsers: 'ios >= 11, android >= 5, chrome >= 54',
cssModules: {
pattern: process.env.CI_TEST === 'test' ? '[name]__[local]' : '[local]__[hash]',
},
/**
* The public path for absolute paths in css
*/
publicPath: __dirname,
}),
],
};
if you want to use absolute paths, you can specify the publicPath
option
TODO
- Support for Stylus
- Support for Sass
0.3.2-beta.1
7 months ago
0.3.2-beta.0
7 months ago
0.3.2
7 months ago
0.2.2
7 months ago
0.3.4
6 months ago
0.3.3
6 months ago
0.3.2-beta.2
7 months ago
0.3.0
1 year ago
0.3.1
1 year ago
0.2.1
1 year ago
0.2.0
1 year ago
0.1.19
1 year ago
0.1.17
2 years ago
0.1.18
2 years ago
0.1.15
2 years ago
0.1.16
2 years ago
0.1.14
2 years ago
0.1.13
2 years ago
0.1.12
2 years ago
0.1.11
2 years ago
0.1.10
2 years ago
0.1.9
2 years ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.5-beta.0
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago