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.
jss-plugin-global
Advanced tools
The jss-plugin-global npm package is a plugin for JSS (JavaScript Style Sheets) that allows you to define global CSS rules within your JSS styles. It enables you to write global selectors (like body, html, or any other global HTML element) inside a JSS object, which will then be applied to the whole document.
Defining global styles
This feature allows you to set global CSS properties for HTML elements. The code sample demonstrates how to set the font-size for the html element and reset the margin and padding for the body element.
{"@global": {"html": {"font-size": "16px"}, "body": {"margin": 0, "padding": 0}}}
Using global selectors
With this feature, you can define styles for global classes. The code sample shows how to change the text color to blue for elements with the class 'my-global-class'.
{"@global": {".my-global-class": {"color": "blue"}}}
Nesting global selectors
This feature allows for nesting within global selectors. The code sample demonstrates how to set a yellow background color for elements with the class 'my-class' that are children of the element with the id 'my-id'.
{"@global": {"#my-id": {"& .my-class": {"background-color": "yellow"}}}}
Styled-components is a library for styling React components using tagged template literals. It allows for defining styles in a component-scoped manner, but also supports global styles via the 'createGlobalStyle' helper. Compared to jss-plugin-global, styled-components offers a more component-centric approach to styling with a different syntax.
Emotion is a performant and flexible CSS-in-JS library that allows you to style applications quickly with string or object styles. It has a similar feature to 'createGlobalStyle' in styled-components called 'Global', which can be used to define global styles. Emotion and jss-plugin-global both allow for global styling, but Emotion provides a more extensive set of features for composing and theming styles.
Aphrodite is another CSS-in-JS library that allows you to write styles in JavaScript and attach them to your components. It does not have a dedicated global styles feature like jss-plugin-global, but you can achieve global styles by defining a style object and then inserting it into the DOM using standard JavaScript. Aphrodite focuses more on inline styles and does not support JSS's plugin system.
Global styles for JSS
See our website jss-plugin-global for more information.
Using npm:
npm install jss-plugin-global
or using yarn:
yarn add jss-plugin-global
FAQs
Global styles for JSS
We found that jss-plugin-global 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
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.