
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@douyinfe/semi-webpack-plugin
Advanced tools
> A webpack plugin for Semi Design to custom theme、replace prefix and so on.
A webpack plugin for Semi Design to custom theme、replace prefix and so on.
The plugin is designed for Semi Design, support webpack4 and webpack5, provides two major abilities:
Install @douyinfe/semi-webpack-plugin
as a development dependency:
npm install --save-dev @douyinfe/semi-webpack-plugin
# or
yarn add --dev @douyinfe/semi-webpack-plugin
Semi Design uses the Scss variables to extract thousands of Design Tokens. You can replace Token through this plugin to achieve theme customization. More info
You can custom theme through three ways:
In order to use the npm package, you need to customize the theme through Semi Design System.After finishing the customization, Semi DSM will generate a npm package for you, and then you can use it like this.
// webpack.config.js
const SemiPlugin = require('@douyinfe/semi-webpack-plugin').default;
module.exports = {
// ...
plugins: [
new SemiPlugin({
theme: '@douyinfe/semi-theme-default'
})
]
// ...
};
You can check which tokens can be customized on the Semi WebSite.
// local.scss
$font-size-small: 16px;
// webpack.config.js
const path = require('path');
const SemiPlugin = require('@douyinfe/semi-webpack-plugin').default;
module.exports = {
// ...
plugins: [
new SemiPlugin({
include: path.join(__dirname, 'local.scss')
})
]
};
// webpack.config.js
const SemiPlugin = require('@douyinfe/semi-webpack-plugin').default;
module.exports = {
// ...
plugins: [
new SemiPlugin({
variables: {
"$font-size-small": '16px'
}
})
]
};
The CSS selectors used by Semi Design is prefixed with semi by default(e.g, .semi-button
).You can replace the prefix through this plugin.
// webpack.config.js
const SemiPlugin = require('@douyinfe/semi-webpack-plugin').default;
module.exports = {
// ...
plugins: [
new SemiPlugin({
prefixCls: 'custom'
})
]
// ...
};
Then you get the replaced CSS selectors(e.g, .custom-button
).
Type: String
The prefix of CSS selector.
Type: String
or Object
When the type is string, it represents the name of npm for custom theme.You can use Semi Design System to custom theme.
Same performance as when the type of options.theme
is string.
Type: String
The absolute path of the local Scss file.
Type: Object
The key-value pair of Scss token.
Type: Boolean
In the compilation phase, whether to exclude css references.Used to solve the problem that Next.js does not support the global introduction of css in third-party code.See this discussion.
Type: webpack NormalModule
Type: String
The path of webpack loader that extract css.
Type: Object
The options of webpack loader that extract css.
Type: (loaderList:any[])=>any[]
You can customize how webpack process semi related styles by override the loader with this option. The function will receive the loader list of default loaders(include options.extractCssOptions) and you should return your new loader list. The best practice is just only add your loader to the list rather than delete or change the default loaders since some core logic is in there.
In webpack@5, some hooks need to be obtained through api NormalModule.getCompilationHooks
. But in some scenarios, webpack will not be installed, such as Next.js. Therefore, the user is required to pass in NormalModule as a parameter.
FAQs
> A webpack plugin for Semi Design to custom theme、replace prefix and so on.
The npm package @douyinfe/semi-webpack-plugin receives a total of 639 weekly downloads. As such, @douyinfe/semi-webpack-plugin popularity was classified as not popular.
We found that @douyinfe/semi-webpack-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.