Loading local JS scripts #367
-
For loading JS code, we have But what if you want to use your CLOG app offline? You then want the script loaded from a local file. For that, I see only one possibility: define your own Unfortunately, that's not composable. If everyone does it, we won't be able to integrate each other's code. So... is there another way? |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 22 replies
-
My original thought (not per se the answer) is that every new project starts with its own static-root, and that is the case with all the templates and in truth still solidly the start for any project. That is why the templates are designed that during design time, you load (ql:quicktime :myproj/tools) and during deployment (ql:quicktime :myproj) the idea being that the tools system loads builder related resources, the design time portions of plug-ins etc. So till now, I have relied on plug-ins using an internet based resource for their files or you manually copy. So the code in the plug-ins templates or look at clog-ace. The code is designed to fall over to internet if the resource not there. It is a system that works, but is does leave things up in the air a bit for a non-plugin library or code base and just in general. So a tool makes sense to solve and a standard of what is and what will be. I will work on asap. |
Beta Was this translation helpful? Give feedback.
-
Here is an idea for something that could work, but I have no idea how straightforward it would be to implement. Imagine CLOG having an asset registry for JS code (but also fonts etc.). In Lisp code, I'd write something like
and then
CLOG would set up the underlying Web server to serve a local file from |
Beta Was this translation helpful? Give feedback.
-
Part of the way there, I reworked the server so that now I can control at run-time where files are served out of. I will set up a way to register paths in the www directory to arbitrary directory locations. Then set up a way to have plug-ins auto register their needed paths or allow the user to choose to do so. |
Beta Was this translation helpful? Give feedback.
-
clog-connection:add-plugin-path - use alternate static-paths based on regex - this allows plugins and libraries to share your html directory with its own resources |
Beta Was this translation helpful? Give feedback.
-
We are now all the way here, take a look at the init function for clog-ace to see how I used so can dynamically add any resource dirs you need. Also update clog-ace with changes I made for CLOG-Builder so that will come over in your use of clog-ace. |
Beta Was this translation helpful? Give feedback.
-
Do you know a good html pretty print for Lisp or in JS? |
Beta Was this translation helpful? Give feedback.
-
I did a very basic test, which fails:
Then point my browser at http://127.0.0.1:8080/test/README.md. All I see is "Not found". But I can point my browser at http://127.0.0.1:8080/clog-ace/src/ace.js and see the JavaScript file. What's the difference? Read permissions are the same on those two files. |
Beta Was this translation helpful? Give feedback.
-
It's nice to be able to inspect the HTML code corresponding to a clog object! |
Beta Was this translation helpful? Give feedback.
-
I am fairly happy with results, the builder now uses it. You can also use the JS and CSS formatter for your project. The idea the JS is an extension of Lisp now is something people do not realize the benefits from. |
Beta Was this translation helpful? Give feedback.
-
fukamachi is going to expose the API I am using for this so doesn't disappear in the future. |
Beta Was this translation helpful? Give feedback.
We are now all the way here, take a look at the init function for clog-ace to see how I used so can dynamically add any resource dirs you need. Also update clog-ace with changes I made for CLOG-Builder so that will come over in your use of clog-ace.