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)