node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »

css-safe

css-safe

Make string safe for CSS.

Install

via npm:

$ npm install --save css-safe

Supports Node, AMD, browser global via UMD.

Use

var cssSafe = require('css-safe');
 
var safe = cssSafe('Red, and blue.');
// 'red__002c-and-blue__0021'