leopard-js / sb-edit

Javascript library for manipulating Scratch project files
MIT License
50 stars 13 forks source link

toLeopard: Support relative "packaged" leopard library paths #91

Closed towerofnix closed 1 year ago

towerofnix commented 1 year ago

For standalone sharing of projects, it's convenient to be able to package Leopard's library files right in the same folder as generated Leopard project source. This enables that use case by respecting leopardJSURL and leopardCSSURL values which are neither external (e.g. https://unpkg.com/...") nor absolute/root-relative (e.g. /leopard.min.css). If such a relative path is provided, e.g. leopard.min.css or lib/leopard.min.js, toLeopard will automatically supply the appropriate ./ or ../ prefix when importing the path in generated source.

Manually tested with custom local paths leopard.min.js and foo%20bar%20baz/leopard.min.js and snapshot-tested with the default unpkg values.

This is a standalone change which doesn't support any other PRs.