Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

insert-css

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insert-css

insert a string of css into the <head>

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
192K
decreased by-18.07%
Maintainers
3
Weekly downloads
 
Created

What is insert-css?

The insert-css npm package allows you to dynamically insert CSS styles into a webpage from JavaScript. This can be useful for adding styles to components or elements without needing to modify the main stylesheet.

What are insert-css's main functionalities?

Insert CSS Styles

This feature allows you to insert a string of CSS styles into the document. The provided code sample demonstrates how to use the insert-css package to add a CSS rule that sets the text color of elements with the class 'my-class' to red.

const insertCss = require('insert-css');
const css = '.my-class { color: red; }';
insertCss(css);

Insert CSS with Options

This feature allows you to insert CSS styles with additional options. The 'prepend' option, for example, ensures that the new styles are added at the beginning of the <head> section. The code sample demonstrates how to use this feature to insert a CSS rule that sets the text color of elements with the class 'my-class' to blue, and ensures the rule is added at the beginning of the <head>.

const insertCss = require('insert-css');
const css = '.my-class { color: blue; }';
const options = { prepend: true };
insertCss(css, options);

Other packages similar to insert-css

Keywords

FAQs

Package last updated on 14 Nov 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc