Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@rsbuild/plugin-styled-components
Advanced tools
An Rsbuild plugin to provide compile-time support for styled-components. It improves debugging and adds server-side rendering support for styled-components.
An Rsbuild plugin to provide compile-time support for styled-components. It improves debugging and adds server-side rendering support for styled-components.
styled-components is a popular CSS-in-JS implementation library, which uses the new JavaScript feature Tagged template to write component CSS styles.
Install:
npm add @rsbuild/plugin-styled-components -D
Add plugin to your rsbuild.config.ts
:
// rsbuild.config.ts
import { pluginStyledComponents } from "@rsbuild/plugin-styled-components";
export default {
plugins: [pluginStyledComponents()],
};
After registering the plugin, you can use styled-components to write styles:
import styled from "styled-components";
const div = styled.div`
color: red;
`;
console.log("div", div);
If you need to customize the compilation behavior of styled-components
, you can use the following configs.
You can check the styled-components documentation to learn how to use it.
type StyledComponentsOptions = {
displayName?: boolean;
ssr?: boolean;
fileName?: boolean;
meaninglessFileNames?: string[];
namespace?: string;
topLevelImportPaths?: string[];
transpileTemplateLiterals?: boolean;
minify?: boolean;
pure?: boolean;
cssProps?: boolean;
};
{
displayName: true,
// `isSSR` is true in SSR build
ssr: isSSR,
// `pure` is enabled in production to reduce bundle size
pure: isProd,
transpileTemplateLiterals: true,
}
When the value is an Object, use the Object.assign
function to merge with the default config.
pluginStyledComponents({
pure: true,
});
MIT.
FAQs
An Rsbuild plugin to provide compile-time support for styled-components. It improves debugging and adds server-side rendering support for styled-components.
We found that @rsbuild/plugin-styled-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.