less-openui5 0.11.3 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const CSSVariablesCollectorPlugin = module.exports = function(config) {
|
|
|
11
11
|
this.ruleStack = [];
|
|
12
12
|
this.mixinStack = [];
|
|
13
13
|
this.parenStack = [];
|
|
14
|
+
this.fontFaceDirectiveStack = [];
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
CSSVariablesCollectorPlugin.prototype = {
|
|
@@ -20,8 +21,8 @@ CSSVariablesCollectorPlugin.prototype = {
|
|
|
20
21
|
|
|
21
22
|
isReplacing: true,
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
return this.mixinStack.length > 0 || this.parenStack.length > 0;
|
|
24
|
+
_isInMixinOrParenOrFontFaceDirective() {
|
|
25
|
+
return this.mixinStack.length > 0 || this.parenStack.length > 0 || this.fontFaceDirectiveStack.length > 0;
|
|
25
26
|
},
|
|
26
27
|
|
|
27
28
|
_isVarInRule() {
|
|
@@ -39,7 +40,7 @@ CSSVariablesCollectorPlugin.prototype = {
|
|
|
39
40
|
},
|
|
40
41
|
|
|
41
42
|
_isRelevant() {
|
|
42
|
-
return !this.
|
|
43
|
+
return !this._isInMixinOrParenOrFontFaceDirective() && this._isVarInRule();
|
|
43
44
|
},
|
|
44
45
|
|
|
45
46
|
toLessVariables(varsOverride) {
|
|
@@ -153,7 +154,7 @@ CSSVariablesCollectorPlugin.prototype = {
|
|
|
153
154
|
visitRule(node, visitArgs) {
|
|
154
155
|
// check rule for being a variable declaration
|
|
155
156
|
const isVarDeclaration = typeof node.name === "string" && node.name.startsWith("@");
|
|
156
|
-
if (!this.
|
|
157
|
+
if (!this._isInMixinOrParenOrFontFaceDirective() && isVarDeclaration) {
|
|
157
158
|
// add the variable declaration to the list of vars
|
|
158
159
|
const varName = node.name.substr(1);
|
|
159
160
|
const isVarInLib = this._isVarInLibrary({
|
|
@@ -199,6 +200,22 @@ CSSVariablesCollectorPlugin.prototype = {
|
|
|
199
200
|
return node;
|
|
200
201
|
},
|
|
201
202
|
|
|
203
|
+
visitDirective(node, visitArgs) {
|
|
204
|
+
// store the @font-face directive context
|
|
205
|
+
if (node.name === "@font-face") {
|
|
206
|
+
this.fontFaceDirectiveStack.push(node);
|
|
207
|
+
}
|
|
208
|
+
return node;
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
visitDirectiveOut(node) {
|
|
212
|
+
// remove @font-face directive context
|
|
213
|
+
if (node.name === "@font-face") {
|
|
214
|
+
this.fontFaceDirectiveStack.pop();
|
|
215
|
+
}
|
|
216
|
+
return node;
|
|
217
|
+
},
|
|
218
|
+
|
|
202
219
|
visitUrl(node, visitArgs) {
|
|
203
220
|
// we mark the less variables which should be updated after eval
|
|
204
221
|
// => strangewise less variables with "none" values are also urls
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-openui5",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "Build OpenUI5 themes with Less.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"url": "git@github.com:SAP/less-openui5.git"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@adobe/css-tools": "^4.0.1",
|
|
86
85
|
"clone": "^2.1.2",
|
|
86
|
+
"css": "^3.0.0",
|
|
87
87
|
"mime": "^1.6.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|