![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
astro-css-components
Advanced tools
Readme
⚠️ Very early in development, more of a proof of concept than a real thing at the moment ⚠️
Add "CSS Components" support to Astro, inspired by eleventy-assets. This allows you to for instance, add page specific CSS. In my personal blog, I use it to add the CSS needed for syntax coloring only to the page that have code in them
The API is currently.. not very good. Use at your own caution - it should works, however
Page.astro
---
import BaseLayout from "BaseLayout.astro"
import { CSSComponent } from "astro-css-components"
---
<CSSComponent register={{ name: "should-be-red", content: ".should-be-red {color: red;}" }} />
<BaseLayout>
<article>
<div class="should-be-red">My super text</div>
</article>
</BaseLayout>
BaseLayout.astro
---
import { CSSComponent } from "astro-css-components"
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<CSSComponent getForURL />
</head>
<body>
<slot />q
</body>
</html>
Result
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>.should-be-red {color: red;}</style>
</head>
<body>
<article>
<div class="should-be-red">My super text</div>
</article>
</body>
</html>
The CSSComponent component takes the following props:
Used to register a new component, it takes an object with the following attributes:
OR
Unless used with global, the component will be tied to the current URL
Examples:
<CSSComponent register={{ name: "should-be-red", content: ".should-be-red {color: red;}" }} />
<CSSComponent register={{ name: "code", contentFile: "src/theme/css/modules/code.css" }} />
By adding this props, you can make the component global, this mean you can call it from everywhere using getByName
Example:
<CSSComponent global register={{ name: "should-be-blue", content: ".should-be-blue {color: blue;}" }} />
By adding this props, you can only register the component when a certain condition is met
Example:
<CSSComponent register={{ name: "should-be-orange", content: ".should-be-orange {color: orange;}" }} conditional={page.loadCSSModules.includes("orange")} />
By adding this props, the CSS will be minified through csso
Example:
<CSSComponent minify register={{ name: "should-be-purple", content: ".should-be-purple {color: purple;}" }} />
Get the components for the current URL, this get all the components registered for the current URL, to get a specific component, use getByName
Example:
<CSSComponent getForURL />
Get a specific component by name, this look in both the library for the current url and the global one
Example:
<CSSComponent getByName="should-be-yellow" />
FAQs
CSS Components for Astro
We found that astro-css-components 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.