Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
styled-normalize
Advanced tools
The styled-normalize package is a utility for applying a CSS normalization stylesheet using styled-components. It helps to ensure consistent styling across different browsers by resetting default browser styles.
CSS Normalization
This feature allows you to apply a CSS normalization stylesheet globally in your application using styled-components. It resets default browser styles to ensure consistency across different browsers.
import { createGlobalStyle } from 'styled-components';
import normalize from 'styled-normalize';
const GlobalStyle = createGlobalStyle`
${normalize}
`;
export default GlobalStyle;
normalize.css is a popular CSS library that provides cross-browser consistency in the default styling of HTML elements. Unlike styled-normalize, which is designed to be used with styled-components in a React environment, normalize.css can be used in any web project by including the CSS file.
sanitize.css is a CSS library that provides a more opinionated reset compared to normalize.css. It aims to make browsers render elements more consistently and in line with modern standards. Like normalize.css, it is not tied to styled-components and can be used in any web project.
reset-css is a simple CSS reset library that removes all default browser styling. It is less comprehensive than normalize.css and sanitize.css but can be useful for projects that require a minimal reset. It is also not tied to styled-components and can be used in any web project.
CSS-normalize library for styled-components.
The original normalize.css
is pulled from necolas/normalize.css, and parsed into styled ready format.
npm install --save styled-normalize
yarn add styled-normalize
Package exported normalize
and Normalize
. Normalize
is a component with global styles. normalize
is a css-normalize content to interpolate into styled component.
Use as component:
// index.js
import React from 'react'
import ReactDOM from 'react-dom'
import { Normalize } from 'styled-normalize'
import { App } from './app'
const Root = () => (
<React.Fragment>
<Normalize />
<App />
</React.Fragment>
)
ReactDOM.render(<Root />, document.querySelector('#root'))
Also you can use createGlobalStyle
API:
// styles/index.js
import { createGlobalStyle } from 'styled-components'
import { normalize } from 'styled-normalize'
export const GlobalStyle = createGlobalStyle`
${normalize}
// You can continue writing global styles here
body {
padding: 0;
background-color: black;
}
`
// index.js
import React from 'react'
import ReactDOM from 'react-dom'
import { GlobalStyle } from './styles'
import { App } from './app'
const Root = () => (
<React.Fragment>
<GlobalStyle />
<App />
</React.Fragment>
)
ReactDOM.render(<Root />, document.querySelector('#root'))
You can also use named imports:
// ES Modules
import { normalize, Normalize } from 'styled-normalize'
// CommonJS
const { normalize, Normalize } = require('styled-normalize')
If you want to use styled-normalize
with styled-components@v3
you should use prev
npm tag.
npm install styled-normalize@prev
v3 don't supports
createGlobalStyle
API.
NO SEMVER!
Why? Because X.Y numbers in vX.Y.Z
version matches X.Y in normalize.css
The MIT License
FAQs
Normalize.css for styled-components CSS-in-JS library
The npm package styled-normalize receives a total of 99,661 weekly downloads. As such, styled-normalize popularity was classified as popular.
We found that styled-normalize demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.