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

generic-names

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generic-names

Helper for building generic names, similar to webpack

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
780K
decreased by-53.13%
Maintainers
1
Weekly downloads
 
Created

What is generic-names?

The `generic-names` package is a utility for generating generic names based on a pattern. It is commonly used in the context of CSS module development to create consistent and unique class names based on the file name and local name (class name) to avoid naming collisions. This package allows developers to customize the naming convention, making it a flexible tool for managing CSS class names in a modular fashion.

What are generic-names's main functionalities?

Generating generic names

This feature demonstrates how to generate a generic name using the `generic-names` package. The `generate` function takes a pattern and options as arguments. The pattern includes placeholders like `[name]`, `[local]`, and `[hash:base64:5]` which are replaced with the file name, local name (class name), and a hash respectively. The `context` option specifies the directory to consider as the root for relative paths. The generated name is unique and consistent, making it suitable for use as a CSS class name in modular CSS systems.

const generate = require('generic-names');
const nameGenerator = generate('[name]__[local]___[hash:base64:5]', { context: process.cwd() });
console.log(nameGenerator('className', '/path/to/file.css'));

Other packages similar to generic-names

Keywords

FAQs

Package last updated on 31 Oct 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc