#!/bin/js if( args[1] == undefined ) return "usage: codemirror " AFRAME.utils.require({ codemirrorjs: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.1/codemirror.js", codemirrorcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/codemirror.css", cmtheme: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/theme/shadowfox.css" }) .then( () => AFRAME.utils.require({ cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js", cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js", cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js", highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js", codemirrorAF: "com/codemirror.js" }) ) .then( () => { let el = document.createElement("a-entity") el.setAttribute("codemirror", `file: ${args[1]}`) document.querySelector("a-scene").appendChild(el) }) return "" // empty stdout(put) // for shellscript-equivalent see bin/codemirror