flat-geo-css

1.0.6 • Public • Published

flat-geo-css

This package translates a flat geocss encoding to a json structure and vice versa.

Examples

  • From geocss encoding to json structure example
import flatGeoCSS from 'flat-geo-css';

const geoCSSJSON = flatGeoCSS.read(`
@mode 'Flat';
* {
    fill: #aaff33;
    stroke: #333333;
    stroke-width: 4;
}`);

// geoCSSJSON output
/*
{
    "directive": {
        "@mode": "Flat"
    },
    "rules": [
        {
            "group": 1,
            "properties": {
                "fill": [
                    "hex",
                    "#aaff33"
                ],
                "stroke": [
                    "hex",
                    "#333333"
                ],
                "stroke-width": 4
            },
            "selector": "*"
        }
    ]
}
*/
  • From json structure to geocss encoding example
import flatGeoCSS from 'flat-geo-css';

const style = flatGeoCSS.write({
    "directive": {
        "@mode": "Flat"
    },
    "rules": [
        {
            "group": 1,
            "properties": {
                "fill": [
                    "hex",
                    "#aaff33"
                ],
                "stroke": [
                    "hex",
                    "#333333"
                ],
                "stroke-width": 4
            },
            "selector": "*"
        }
    ]
});

// style output
/*
@mode 'Flat';
* {
    fill: #aaff33;
    stroke: #333333;
    stroke-width: 4;
}
*/

Readme

Keywords

none

Package Sidebar

Install

npm i flat-geo-css

Weekly Downloads

133

Version

1.0.6

License

BSD-2-Clause

Unpacked Size

35.7 kB

Total Files

4

Last publish

Collaborators

  • offtherailz
  • mv88
  • allyoucanmap
  • mbarto