Noiseless Praying Mantis
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    css-to-js-objectpublic

    css-to-js-object

    Experimental: convert css to a JS object. Inspired by: https://speakerdeck.com/vjeux/react-css-in-js.

    Installation

    npm install css-to-js-object

    Example

    From:

    .modal {
      border-style: dotted;
    }
     
    .header {
      color: yellow;
    }
     
    .body {
      background: green;
    }
     
    .footer,
    .another {
      border: 1px solid green;
      border-radius: 7px;
    }
     
    .something.else {
      transform: translateZ(0);
    }
     
    #tag {
      margin: 10px;
      padding: 20px;
      color: green;
    }
     
    test-pilot {
      color: blue
    }
     
    span {
      text-align: center;
    }

    To:

    {
      ".modal": {
        "borderStyle": "dotted"
      },
      ".header": {
        "color": "yellow"
      },
      ".body": {
        "background": "green"
      },
      ".footer": {
        "border": "1px solid green",
        "borderRadius": "7px"
      },
      ".another": {
        "border": "1px solid green",
        "borderRadius": "7px"
      },
      ".something.else": {
        "webkitTransform": "translateZ(0)",
        "transform": "translateZ(0)"
      },
      "#tag": {
        "margin": "10px",
        "padding": "20px",
        "color": "green"
      },
      "test-pilot": {
        "color": "blue"
      },
      "span": {
        "textAlign": "center"
      }
    }

    License

    (The MIT License)

    Copyright (c) 2015 Matthew Mueller <matt@lapwinglabs.com>

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Keywords

    none

    install

    npm i css-to-js-object

    Downloadslast 7 days

    4

    version

    0.0.3

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar