
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@fbem/css-loader
Advanced tools
@fbem/css-loader is a loader for webpack, which allows you to load CSS and compile it to BEM functions. @fbem/css-loader is a fork of css-loader.
Warning
- webpack@5 is required
- mini-css-extract-plugin@2.7.0+ is required
npm i -D @fbem/css-loader
webpack.config.js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, "@fbem/css-loader"],
},
],
},
};
urltype UrlOption = boolean | { filter: (url: string, resourcePath: string) => boolean; }
Default: true
Allow to enable/disable handling the CSS functions url and image-set.
A function can also be passed to control this behavior dynamically based on the path to the asset.
importtype ImportOption = boolean | { filter: (url: string, media: string, resourcePath: string) => boolean }
Default: true
Allows to enable/disable @import at-rules handling.
A function can also be passed to control this behavior dynamically based on the path to the asset.
namingtype NamingOption = {
elem?: string,
modName?: string,
modVal?: string,
prefix?: string
}
Default:
{
elem: '__',
modName: '_',
modVal: '_',
prefix: 'cn'
}
Allows to specify separators for parsing classnames according to the rules of the BEM methodology, also allows to specify a prefix for exported BEM functions.
exportGlobalstype ExportGlobalsOption = boolean
Default: false
Allow @fbem/css-loader to export names from global class or id, so you can use that as local name.
exportOnlyLocalstype ExportOnlyLocalsOption = boolean
Default: false
Useful when you use for pre-rendering (for example SSR).
@fbem/css-loader doesn't embed CSS but only exports the identifier mappings.
sourceMaptype SourceMapOption = boolean
Default: depends on the compiler.devtool value
By default generation of source maps depends on the devtool option. All values enable source map generation except eval and false value.
importLoaderstype ImportLoadersOption = number
Default: 0
Allows to enable/disable or specify number of loaders applied before CSS loader for @import at-rules, CSS modules and ICSS imports, i.e. @import/composes/@value value from './values.css'/etc.
autotype AutoOption = boolean | RegExp | ((path: string) => boolean);
Default: undefined
Allows auto enable CSS modules/ICSS (imports & exports from CSS) based on filename.
localIdenttype LocalIdentOption = {
name?: string,
context?: string,
hashSalt?: string,
hashDigest?: string,
hashDigestLength?: number,
hashFunction?: any;
hashStrategy?: 'resource-path-and-local-name' | 'minimal-subset';
regExp?: string | RegExp;
get?: (context: LoaderContext<Options>, localIdentName: string, localName: string) => string;
}
Default:
const localIdent = {
name: '[hash:base64]',
context: loaderContext.rootContext,
hashSalt: loaderContext._compilation.hashSalt,
hashFunction: loaderContext._compilation.hashFunction,
hashDigest: loaderContext._compilation.hashDigest,
hashDigestLength: loaderContext._compilation.hashDigestLength
}
Allows to configure the generated local ident name.
FAQs
Functional BEM CSS loader for Webpack
We found that @fbem/css-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.