-
Notifications
You must be signed in to change notification settings - Fork 5
Description
It's not the same file path as CONTENT and BODY tabs.
It's because we use relative path for HTML, but JS and CSS are'nt located at the same place.
And it's not "sub-folder agnostic". As it's quite uncomfortable to use relative path (../../media/burger.jpg
), I think, most user would use absolute path. Which prevent W from being moved in a sub-folder easily.
Page path
domain.com/page-1
When W is inside subfodler
domain.com/sub-folder/page-1
JS and CSS path
domain.com/assets/render/page-1.js
domain.com/assets/render/page-1.css
To solve this, I see two main options:
- rewrite path when writing files
- serve js and css files from the same path as the HTML
option 1
Using the same relative syntax as HTML:
./media/burger.jpg
And convert it to absolute path
/media/burger.jpg
Or, if W is in a subfodler
/sub-folder/media/burger.jpg
The main problem I see is that it will be very confusing when comparing the code with Web browser inspector. As many user use it to edit page's CSS and JS
option 2
This is more transparent. But this mean writing a solid file serving interface in PHP, which will have to go through Alto router. It would be important to implement HTTP caching for example.
Maybe there is a smartest way to do it using Apache rewrite engine.