3 ms·
At the risk of bikeshedding, what's with the syntax? Would it not make sense to stick closer to HTML tags? eg. <script type="importmap" name="browser-fs-
by SquareWheel 3y ago
At the risk of bikeshedding, what's with the syntax? Would it not make sense to stick closer to HTML tags? eg.
<script type="importmap" name="browser-fs-access" src="https://unpkg.com/browser-fs-access@0.33.0/dist/index.modern.js">
The current implementation seems like something I'd have to look up every time I wanted to use it.
- lucideer 3y agoThis likely stems from the proposers building on existing "in-the-wild" development patterns: it's become a convention for DSLs in the JS development community. Consider similar for a larger amount of data: <script type="custom-dsl">{ "very": { "large": "json", "object": "with", "many": "keys" }</script> Even sticking strictly to JSON (the DSL can be any syntax), this has a few advantages to SGML-style attributes: 1. Supports nesting to any depth 2. Easier to deserialize from an in-memory object in the most common server-side languages 3. Supports easy developer/hacker copypasta into a JS file for debugging. 4. Broader/better expand/collapse support in text editors (in the case of very large lists) --- > I'd have to look up every time I wanted to use it I'd likely have to look up the HTML attribute names just as much - I recall having to do this a lot at first with the viewport meta when it was introduced - the only real hurdle to get over with this is to internalise the following pattern (which, as mentioned, some in the JS community are already familiar with): <script type="dsl-name">DSL SOURCE</script>
- ramses0 3y agoIt matches exactly the on-disk format for deno.json / import_map.json. Based on my limited experience with it, I was super-stoked to see it be basically: “oh, what I was messing around with last night when trying out deno!”
- WorldMaker 3y agoThe current implementation is so that you can `<script type="importmap" src="path/to/your/importmap.json"></script>`. JSON is a well-known on-disk data format with lots of tools that support working with it and manipulating it (including plenty JS itself including natively in the browser). You can even `<script type="importmap" src="https://your.fave.cdn.example.org/shared-importmap.json"></script> https://your.fave.cdn.example.org/shared-importmap.json"></s...` and share an importmap across multiple applications/projects.