Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using medias in CSS and JS is not confortable #502

Open
vincent-peugnet opened this issue Feb 4, 2025 · 0 comments
Open

Using medias in CSS and JS is not confortable #502

vincent-peugnet opened this issue Feb 4, 2025 · 0 comments
Labels
breaking-change This create a breaking change editor enhancement New feature or request

Comments

@vincent-peugnet
Copy link
Owner

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:

  1. rewrite path when writing files
  2. 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.

@vincent-peugnet vincent-peugnet added breaking-change This create a breaking change editor enhancement New feature or request labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This create a breaking change editor enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant