DEV Community

Hidenori FUJIMURA
Hidenori FUJIMURA

Posted on

style.json from Apple Pkl #1

I am trying to generate style.json for MapLibre GL JS or Mapbox GL JS. This is the first attempt.

Check how module works

colors.pkl

module colors

red { "rgb" 255 0 0 }
green { "rgb" 0 255 0 }
blue { "rgb" 0 0 255 }
Enter fullscreen mode Exit fullscreen mode

use_color.pkl

import "colors.pkl"

the_color = colors.blue
Enter fullscreen mode Exit fullscreen mode

Makefile

use_color: 
    pkl eval -f json use_color.pkl
Enter fullscreen mode Exit fullscreen mode

Result

{
  "the_color": [
    "rgb",
    0,
    0,
    255
  ]
}
Enter fullscreen mode Exit fullscreen mode

Ok.

See also

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more