Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A StyleSheetMap instance is a Map-like object that allows adding, updating, and deleting CSS rules through key-value pairs. It provides a convenient way to manage and manipulate CSS stylesheets, simplifying the handling of dynamic styles.

License

NotificationsYou must be signed in to change notification settings

baotlake/style-sheet-map

Repository files navigation

A StyleSheetMap instance is a Map-like object that allows adding, updating, and deleting CSS rules through key-value pairs. It provides a convenient way to manage and manipulate CSS stylesheets, simplifying the handling of dynamic styles.

Installation

# npmnpm i style-sheet-map# yarnyarn add style-sheet-map# pnpmpnpm add style-sheet-map

Usage

importStyleSheetMapfrom"style-sheet-map";// Create a new StyleSheetMap instanceconststyleMap=newStyleSheetMap({rules:[["header","header { color: blue; }"],["paragraph","p { font-size: 16px; }"],],onCreated:(sheet)=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,sheet];},});// Dynamically adding new CSS rulesstyleMap.set("button","button { background-color: green; }");// Update existing CSS rulesstyleMap.set("header","header { color: red; }");// Deleting a CSS rulestyleMap.delete("paragraph");// Disable the entire stylesheetstyleMap.disable=true;

Project Origin

The concept and code for StyleSheetMap were initially developed as part of theAnything Copilot project. This project extracts and refines that functionality into a standalone, general-purpose module.

Discover more about its origins:Anything Copilot

License

This project is licensed under the MIT License.

About

A StyleSheetMap instance is a Map-like object that allows adding, updating, and deleting CSS rules through key-value pairs. It provides a convenient way to manage and manipulate CSS stylesheets, simplifying the handling of dynamic styles.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp