forked from less/less.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(issue:4224, issue:3777) CSS custom property
* Fixes CSS custom property handling to address issue less#4224 and issue less#3777. * Added new CSS custom property tests.
- Loading branch information
Showing
7 changed files
with
122 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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,18 @@ | ||
/* eslint-disable no-prototype-builtins */ | ||
import Node from './node'; | ||
|
||
const CustomProperty = function (name, index, currentFileInfo) { | ||
this.name = name; | ||
this._index = index; | ||
this._fileInfo = currentFileInfo; | ||
}; | ||
|
||
CustomProperty.prototype = Object.assign(new Node(), { | ||
type: 'CustomProperty', | ||
|
||
genCSS: function (context, output) { | ||
output.add('var(' + this.name + ')'); | ||
} | ||
}); | ||
|
||
export default CustomProperty; |
This file contains 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 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 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,16 @@ | ||
.test { | ||
--basic-deg: 20deg; | ||
--basic-deg-tan: tan(var(--basic-deg)); | ||
} | ||
.test2 { | ||
--some-var: 5%; | ||
prop: min(95%, 10px); | ||
} | ||
.test3 { | ||
--some-var: 55%; | ||
prop: min(60%, 15px); | ||
} | ||
.test4 { | ||
color: red; | ||
--other-color: green; | ||
} |
This file contains 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,19 @@ | ||
.test { | ||
--basic-deg: 20deg; | ||
--basic-deg-tan: tan(var(--basic-deg)); | ||
} | ||
|
||
.test2 { | ||
--some-var: 5%; | ||
prop: min(100% - var(--some-var), 10px); | ||
} | ||
|
||
.test3 { | ||
--some-var: 55%; | ||
prop: min(var(--some-var) + 5%, 15px); | ||
} | ||
|
||
.test4 { | ||
color: red; | ||
--other-color: green; | ||
} |