Closed NoSloppy closed 1 year ago
loading from file urls
How exactly do you mean? Maybe it's a feature I don't even know exists. Let me know how to recreate so I can chase it down?
I just check out the files, then I use a an url like:
file:///path/to/style_editor.html
(You can see the actual url I used in the error messages above.)
oh yeah, well it needs to be run on a localhost server. You had said this in #90
I think we should add these files into the git repository instead of accessing them remotely. This sets up for making it a PWA in the future. (You can't host remote files in a PWA, they must be from the same domain.)
so just running a local file isn't going to work is there's disembodied CSS, right?
HTML and CSS normally works just fine with file:/// , however there are some not-so-nice permission issues, because different files are counted as if they came from different domains, so they don't have full access to each others content. That's what is happening here, when the CSS rules are loaded from a separate file, they become protected and hidden, and unfortunately this seems to affect all css rules, including the "magic" ones. I'm pretty sure that CSS files loaded from some far-off domain would have the same problem.
PWA is nice for end-users, but it sucks for development, because reloading is kind of iffy. Local servers works of course, but it's much quicker/easier to just load it from a file.
What I said in #90 was because I was giving up on having everything in one file. Not sure if I'm also ready to give up on file:/// urls...
Maybe we should use iconify.design instead of font-awesome? Iconify seems to provide simple SVGs for each icon which can be dumped right into the file with.
well the font awesome could work fine if the css rules that are used just get brought in. That's if we're needing to keep it as a self contained file, which it sounds like you're leaning toward.
This still breaks loading from file urls for me, so I reverted it.
This is the error I get:
style_editor.html?S=Red:9250 Uncaught DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules at ReplaceCurrentFocus (file:///home/hubbe/hack/teensy/lightsaber/ProffieOS-StyleEditor/style_editor.html?S=Red:9250:31) at Run (file:///home/hubbe/hack/teensy/lightsaber/ProffieOS-StyleEditor/style_editor.html?S=Red:9319:3) at initGL (file:///home/hubbe/hack/teensy/lightsaber/ProffieOS-StyleEditor/style_editor.html?S=Red:1255:3) at onload (file:///home/hubbe/hack/teensy/lightsaber/ProffieOS-StyleEditor/style_editor.html?S=Red:9698:25)