css-map-variable

1.0.1 • Public • Published

css-map-variable

  import CssTheme from 'css-map-variable'
  const map = new Map([
    ['color', 'red']
  ])
  const cssTheme = new CssTheme(
    map, document.styleSheets[0], true, '--'
  )//map, styleSheets[0], Whether to add a prefix or not, prefix
  
  setTimeout(()=> {
    map.set('color', 'blue')
  }, 1000)

index.css

:root {
  --color: white;
}

It will re-create your first style tag or [[linkcss]] first rule

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i css-map-variable

      Weekly Downloads

      0

      Version

      1.0.1

      License

      ISC

      Unpacked Size

      1.93 kB

      Total Files

      3

      Last publish

      Collaborators

      • xiaomactx