Skip to content

Conversation

@shish
Copy link

@shish shish commented Aug 18, 2023

This optimisation disables relative paths when the output path is longer than the input path - but the result of that is that the generated CSS ends up pointing to URLs that are relative to the current directory instead of being relative to the generated CSS file.

input: test-in/style.css

.foo { background-image: url("./local.png"); }

When writing to an output directory which is less than or equal to the depth of the input, the path to the file is relative to the output .css

output: test-out/style.css

.foo { background-image: url("../test-in/local.png"); }

When writing to an output directory which is deeper than the input, relativity is disabled, and the path is broken

output: test-out/nested/path/style.css

.foo { background-image: url("test-in/local.png"); }

This optimisation disables relative paths when the output path is longer
than the input path - but the result of that is that the generated CSS
ends up pointing to URLs that are relative to the current directory
instead of being relative to the generated CSS file.

input: test-in/style.css
```
.foo { background-image: url("./local.png"); }
```

output: test-out/style.css
```
.foo { background-image: url("../test-in/local.png"); }
```

output: test-out/nested/path/style.css
```
.foo { background-image: url("test-in/local.png"); }
```
@shish
Copy link
Author

shish commented Nov 13, 2025

(bulk-closing PRs for libraries I'm no longer using)

@shish shish closed this Nov 13, 2025
@tbela99 tbela99 reopened this Nov 25, 2025
@tbela99 tbela99 changed the base branch from master to v.next November 25, 2025 15:20
@tbela99 tbela99 merged commit 217aadc into tbela99:v.next Nov 25, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants