1.0.6 • Published 2 years ago

flat-geo-css v1.0.6

Weekly downloads
93
License
BSD-2-Clause
Repository
-
Last release
2 years ago

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;
}
*/
1.0.6

2 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago