
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
fela-enforce-longhands
Advanced tools
Fela enhancer that enforces longhand over shorthand properties
This enhancers implements are specific propertyPriority
configuration that enforces longhand over shorthand properties. This enforces a certain order, but makes it deterministic which helps to prevent issues.
For example, paddingLeft
will always overwrite the padding-left
value from a padding
property, no matter in which order they are rendered.
It uses a clever CSS specificity trick where repeated selectors increase the specificity and thus a prioritized over others.
For example, if we render the following style:
const style = {
paddingLeft: 10,
padding: 5,
}
the following CSS will be rendered respectively:
.a.a {
padding-left: 10px;
}
.b {
padding: 5px;
}
Check Selectors Level 3 for more information.
yarn add fela-enforce-longhands
You may alternatively use npm i --save fela-enforce-longhands
.
import { createRenderer } from 'fela'
import enforceLonghands from 'fela-enforce-longhands'
const renderer = createRenderer({
enhancers: [enforceLonghands()],
})
Property | Type | Default | Description |
---|---|---|---|
borderMode | none | directional | longhand | none | Defines which border properties take priority.none will treat both second level properties (e.g. border-width or border-top ) the same.directional will prioritize e.g. border-top over border-width longhand will prioritize e.g. border-width over border-top |
import { createRenderer } from 'fela'
import enforceLonghands from 'fela-enforce-longhands'
const renderer = createRenderer({
enhancers: [
enforceLonghands({
borderMode: 'directional',
}),
],
})
Fela is licensed under the MIT License.
Documentation is licensed under Creative Commons License.
Created with ♥ by @robinweser and all the great contributors.
FAQs
Fela enhancer that enforces longhand over shorthand properties
The npm package fela-enforce-longhands receives a total of 5,256 weekly downloads. As such, fela-enforce-longhands popularity was classified as popular.
We found that fela-enforce-longhands 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.