npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

jstransformer-cdata-css

0.1.0

@robloach

npmHomeRepoSnykSocket
Downloads:2
$ npm install jstransformer-cdata-css
DailyWeeklyMonthlyYearly

jstransformer-cdata-css

Transformer that converts a CSS string to XML CDATA.

Build Status Coverage Status Dependency Status Greenkeeper badge NPM version

Installation

npm install jstransformer-cdata-css

API

var cdata = require('jstransformer')(require('jstransformer-cdata-css'))

var css = 'p::before { content: "hello world"; }'
console.log(cdata.render(css).body)
// Prints:
// /*<![CDATA[*/
// p::before { content: "hello world"; }
// /*]]>*/

// ']]>' is properly escaped:
css = 'p::before { content: "<[[goodbye world]]>" }'
console.log(cdata.render(css).body)
// Prints:
// /*<![CDATA[*/
// p::before { content: "<[[goodbye world]]]]><![CDATA[>" }
// /*]]>*/

License

MIT