You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

icss-replace-symbols

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icss-replace-symbols

Replacing symbols during the linking phase of ICSS


Version published
Weekly downloads
2M
decreased by-20.76%
Maintainers
1
Install size
3.76 kB
Created
Weekly downloads
 

Package description

What is icss-replace-symbols?

The icss-replace-symbols package is designed for handling Interoperable CSS (ICSS) by replacing symbols in CSS files with their corresponding values. This is particularly useful in the context of CSS Modules, where local class names and other identifiers need to be scoped locally to avoid conflicts. The package provides functionality to parse CSS files, identify symbols, and replace them with specified values, facilitating the modularization and encapsulation of CSS.

What are icss-replace-symbols's main functionalities?

Replacing symbols in CSS

This feature allows for the replacement of symbols within CSS strings. In the code sample, `icss-replace-symbols` is used to replace the symbol `header` with `header_a9x82` in a CSS string. This is useful for scoping class names locally in CSS Modules.

const replaceSymbols = require('icss-replace-symbols');
const css = ':export { header: header_c3b5x } .header { color: red; }';
const replacements = { header: 'header_a9x82' };
const result = replaceSymbols(css, replacements);
console.log(result);

Other packages similar to icss-replace-symbols

Readme

Source

Build Status

ICSS — Replace Symbols

Governs the way tokens are searched & replaced during the linking stage of ICSS loading.

This is broken into its own module in case the behaviour needs to be replicated in other PostCSS plugins (i.e. CSS Modules Constants)

API

import replaceSymbols from "icss-replace-symbols"
replaceSymbols(css, translations)

Where:

  • css is the PostCSS tree you're working with
  • translations is an JS object of symbol: "replacement" pairs, where all occurrences of symbol are replaced with replacement.

Behaviour

A symbol is a string of alphanumeric, - or _ characters. A replacement can be any string. They are replaced in the following places:

  • In the value of a declaration, i.e. color: my_symbol; or box-shadow: 0 0 blur spread shadow-color
  • In a media expression i.e. @media small {} or @media screen and not-large {}

License

ISC


Glen Maddern, 2015.

Keywords

FAQs

Package last updated on 21 May 2017

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc