
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
@flourish/js2css
Advanced tools
Write CSS with D3-style selection syntax.
select("h1")
.style("color", "red")
.style("font-size", "1.25rem");
// h1 {
// color: red;
// font-size: 1.25rem;
// }
Install js2css with NPM npm install -s @flourish/js2css.
Import and initialise js2css in your project, and create styles.
import Stylesheet from "@flourish/js2css";
var styles = new Stylesheet();
styles.select("h1") // h1 {...}
.style("color", "red")
.style("font-size", "1.2rem")
.style("font-weight", "bold")
.style("display", function() {
return window.innerWidth < 400 ? "none" : null
})
.select("span") // h1 span {...}
.style("font-weight", "normal");
document.head.querySelector("#my_style_container").innerHTML = styles.print(); // Add styles to <style> tag in head
styles.clear(); // Clear the styles
select(selector)
Create new CSS selection. Select can be called directly on the js2css object, or on an existing declaration to create nested CSS selection.
style(style_attribute, value)
Create new style for current selection. The value can be a string, number or a function.
print()
Returns the parsed CSS string
clear()
Clears the CSS string
FAQs
Flourish module to convert js inline styles to stylesheet
The npm package @flourish/js2css receives a total of 141 weekly downloads. As such, @flourish/js2css popularity was classified as not popular.
We found that @flourish/js2css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers 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
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.

Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.