Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Alga CSS is a scope-first CSS toolkit for quickly mix or compose the CSS references and share the CSS properties between components
Alga CSS is a scope-first CSS toolkit for quickly mix or compose the CSS references and share the CSS properties between components
What I mean by scope-first is, this Alga CSS is specially made for frameworks or libraries that support scoped-css like Vue
or (Svelte
or Astro
coming soon). Also, my goal in building this is to support all the UI libraries that I have now like vidie
or sastra
.
All the main features:
Alga CSS built on top of PostCSS, so before installing Alga CSS, you need to have PostCSS first and after that you can use NPM or Yarn to install this Alga CSS.
npm install alga-css@next
#or
yarn add alga-css@next
If you use tool that support PostCSS out of the box like Vite for instance, you just need to create a new config file which is postcss.config.js
and add the code below to that file.
const algacss = require('alga-css')
module.exports = {
plugins: [
algacss({
extract: ['./src/**/*.vue', './src/**/*.html']
})
]
}
Alga CSS allow you to use whatever special character you wish (use either -
, .
, :
or _
) as divider or separator of class names or references.
/* highly recommended */
<span class="md.mgTop-5 bgPrimary-725 txtColor.hex(333)"></span>
.className {
ref: md.mgTop-5;
ref: txtColor.rgb(205,45,67);
}
/* alternative */
md.pdTop.2
md-pdBottom-4
md:pdLeft:3
md_pdRight_7
to compose the CSS reference, we provide a custom property which is ref
to apply css property to our class.
.className {
ref: flex justifyCenter flex-20 bgPrimary-3;
}
.otherClassName {
ref: flex;
ref: justifyCenter;
ref: flex-20;
ref: bgPrimary-3;
}
to mix the CSS properties, we provide props
custom property, this only allow to get CSS properties from @set
custom atRule.
@set className {
ref: flex justifyCenter flex-20 bgPrimary-3;
}
.otherClassName {
props: className;
}
to get the CSS custom class (@get
), you can use @get
custom rule and emit
custom property if you want to inject CSS reference to it.
@get className;
/* or */
@get className {
emit: txtBold-5 bdSolid-5;
}
/* or */
@get className {
emit: txtBold-5;
emit: bdSolid-5;
}
Alga CSS also provide a custom atRule for just solving that problem, to create a CSS component, you can use @provide
and if you want to insert that component to your actual CSS file or scope CSS (like using Vue SFC <style scoped>
).
/* Create a component */
@provide componentName {
@get className;
.otherClassName {
ref: flexBetween;
}
@slot slotName;
}
/* Insert the component */
@inject componentName;
/* In the future */
@inject componentName {
slot: className otherClassName;
slotName: anotherClassName;
}
You might want to create a complex layout that based on grid-template
using Alga CSS, like for instance, creating page layout with multiple sections, you can do that by just using our custom atRule @area
.
/* Input: */
@area layoutName {
areas: "a b c" "a b c" "a b c";
x: auto 1fr auto;
y: auto 1fr auto;
layoutSectionA: areaA;
layoutSectionB: areaB;
layoutSectionC: areaC;
}
/* Output: */
.layoutName {
display: grid;
grid-template-areas: "a b c" "a b c" "a b c";
grid-template-columns: auto 1fr auto;
grid-template-rows: auto 1fr auto;
}
.layoutSectionA {
grid-area: a;
}
.layoutSectionB {
grid-area: b;
}
.layoutSectionC {
grid-area: c;
}
FAQs
Alga CSS is a component oriented CSS framework for quickly inject, reuse or compose the style in a single file and can be called inside JavaScript framework SFC file
The npm package alga-css receives a total of 162 weekly downloads. As such, alga-css popularity was classified as not popular.
We found that alga-css 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.