-
Notifications
You must be signed in to change notification settings - Fork 13
[FIX] CSS Variables: Fix variable handling / relative urls #172
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c8f3595
[FIX] Variables: improved detection of library variables
petermuessig 77ca02c
[FIX] Variables: resolve url values in variables
petermuessig 6217f5a
[INTERNAL] Variables: report override only with env var
petermuessig 1fbb1a6
[FIX] Variables: handle variables in the proper order
petermuessig b2ec78d
[FIX] Variables: adopted the test to new behavior (last var wins)
petermuessig 64c00e9
[INTERNAL] Variables: use regex for library-local var detection
petermuessig c99433f
[FIX] Variables: reuse of variables-collector
petermuessig 1f41cc1
[INTERNAL] Variables: using the variable value for override
petermuessig 9e52bc9
[INTERNAL] Variables: improved tests and coverage to be 100%
petermuessig 6169b39
[INTERNAL] Variables: fixed the indentation
petermuessig 76edeed
[INTERNAL] Enhance tests
matz3 15c6fb8
[INTERNAL] Fix RegExp for relative paths used in tests
matz3 a24aa11
[INTERNAL] Cleanup
matz3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@link-color: #428bca; | ||
@link-color-hover: darken(@link-color, 10%); | ||
@other-var: 0 0 0.25rem 0 rgba(0, 0, 0, 0.15), inset 0 -0.0625rem 0 0 @link-color; | ||
@link-color-active: @link-color; | ||
@backgroundVariant: 1; | ||
@backgroundImage: url(img.png); | ||
@a: 100%; | ||
@var: @a; | ||
@b: darken(@link-color-active, 20%); | ||
@padLeft: 20px; | ||
@top: 5rem; | ||
@lineHeight: 2rem; | ||
@c: calc(100% - 80px); | ||
@d: -@a; | ||
@function_lighten14: lighten(@b, 10%); | ||
|
||
:root { | ||
--link-color: @link-color; | ||
--link-color-hover: @link-color-hover; | ||
--other-var: @other-var; | ||
--link-color-active: @link-color-active; | ||
--backgroundVariant: @backgroundVariant; | ||
--backgroundImage: @backgroundImage; | ||
--a: @a; | ||
--var: @var; | ||
--b: @b; | ||
--padLeft: @padLeft; | ||
--top: @top; | ||
--lineHeight: @lineHeight; | ||
--c: @c; | ||
--d: @d; | ||
--function_lighten14: @function_lighten14; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
test/expected/libraries/lib1/my/ui/lib/themes/foo/css_variables.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:root { | ||
--color1: #ffffff; | ||
--url1: url('../base/111'); | ||
} | ||
.fooContrast { | ||
--color1: #000000; | ||
} | ||
|
||
/* Inline theming parameters */ | ||
#sap-ui-theme-my\.ui\.lib{background-image:url('data:text/plain;utf-8,%7B%22default%22%3A%7B%22color1%22%3A%22%23ffffff%22%2C%22url1%22%3A%22url(%27..%2Fbase%2F111%27)%22%7D%2C%22scopes%22%3A%7B%22fooContrast%22%3A%7B%22color1%22%3A%22%23000000%22%7D%7D%7D')} |
7 changes: 7 additions & 0 deletions
7
test/expected/libraries/lib1/my/ui/lib/themes/foo/css_variables.source.less
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@color1: #ffffff; | ||
@url1: url('../base/111'); | ||
|
||
:root { | ||
--color1: @color1; | ||
--url1: @url1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
test/expected/libraries/lib1/my/ui/lib/themes/foo/library_skeleton-RTL.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.myUiLibRule1 { | ||
color: var(--color1); | ||
} | ||
.myUiLibRule2 { | ||
padding: 1px 4px 3px 2px; | ||
} | ||
.fooContrast.myUiLibRule1, | ||
.fooContrast .myUiLibRule1 { | ||
color: var(--color1); | ||
} |
10 changes: 10 additions & 0 deletions
10
test/expected/libraries/lib1/my/ui/lib/themes/foo/library_skeleton.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.myUiLibRule1 { | ||
color: var(--color1); | ||
} | ||
.myUiLibRule2 { | ||
padding: 1px 2px 3px 4px; | ||
} | ||
.fooContrast.myUiLibRule1, | ||
.fooContrast .myUiLibRule1 { | ||
color: var(--color1); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@myColor: #ff0000; | ||
|
||
:root { | ||
--myColor: @myColor; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My expectation was actually the other way round.
To use the "override" values (from the new preVisitor) in general, and only use the current ones for the variable references (which was the main reason for enabling the preEvalVisitor mode).
Otherwise I'd expect that also some other values might differ unexpectedly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are issues within the isPreEval phase where less variables with the value none also have the URL content - so doing it this way is the best to determine properly the variables and apply only the needed later! All other options require much more code!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Would be great to have those specialities documented somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is described in my comments