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.
@greenwood/plugin-css-modules
Advanced tools
A Greenwood plugin for authoring CSS Modules
A Greenwood plugin for authoring CSS Modules ™️. It is a modest implementation of the specification. 🙂
This is NOT to be confused with CSS Module Scripts, which Greenwood already supports.
This package assumes you already have
@greenwood/cli
installed.
You can use your favorite JavaScript package manager to install this package.
examples:
# npm
npm i -D @greenwood/plugin-css-modules
# yarn
yarn add @greenwood/plugin-css-modules --dev
Add this plugin to your greenwood.config.js.
import { greenwoodPluginCssModules } from '@greenwood/plugin-css-modules';
export default {
...
plugins: [
greenwoodPluginCssModules()
]
}
Now you can create a CSS file that ends in .module.css
/* header.module.css */
.container {
display: flex;
justify-content: space-between;
}
.navBarMenu {
border: 1px solid #020202;
}
.navBarMenuItem {
& a {
text-decoration: none;
color: #020202;
}
}
@media screen and (min-width: 768px) {
.container {
padding: 10px 20px;
}
}
And reference that in your (Light DOM) HTML based Web Component
// header.js
import styles from './header.module.css';
export default class Header extends HTMLElement {
connectedCallback() {
this.innerHTML = `
<header class="${styles.container}">
<ul class="${styles.navBarMenu}">
<li class="${styles.navBarMenuItem}">
<a href="/about/" title="Documentation">About</a>
</li>
<li class="${styles.navBarMenuItem}">
<a href="/contact/" title="Guides">Contact</a>
</li>
</ul>
</header>
`;
}
}
customElements.define('app-header', Header);
From there, Greenwood will scope your CSS by prefixing with the filename and a hash, and inline that into a <style>
tag in the HTML and strip the reference to the module.css file from your JavaScript file.
This plugin aims to cover a representative majority of the specification, though if you find missing capabilities please consider submitting an issue and / or PR!
There are some caveats to consider when using this plugin:
/* works ✅ */
.navBar { }
/* does not work 🚫 */
.nav-bar { }
import styles from './header.module.css';
export default class Header extends HTMLElement {
connectedCallback() {
const { container, navBar, ... } = styles;
// ...
}
}
customElements.define('app-header', Header);
@value
variables is not supportedFAQs
A Greenwood plugin for authoring CSS Modules
The npm package @greenwood/plugin-css-modules receives a total of 28 weekly downloads. As such, @greenwood/plugin-css-modules popularity was classified as not popular.
We found that @greenwood/plugin-css-modules demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
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.