-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): remove
ng-less-javascript-enabled-patch
- Loading branch information
Showing
15 changed files
with
244 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
module.exports = { | ||
install: function (less, pluginManager, functions) { | ||
functions.add('genComment', function (value, ...comments) { | ||
return ( | ||
'/* AUTOGENERATE: ' + | ||
comments | ||
.map(c => c.value) | ||
.join('|SPLIT|') | ||
.replace(/(\{0\})/g, '"' + value.value + '"') + | ||
'*/' | ||
); | ||
}); | ||
functions.add('genCommentColor', function (color, ...comments) { | ||
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.value.substring(1) + '/fff.png&text=+)'; | ||
return ( | ||
'/* AUTOGENERATE: ' + | ||
comments | ||
.map(c => c.value + imgColor) | ||
.join('|SPLIT|') | ||
.replace(/(\{0\})/g, '"' + color.value + '"') + | ||
'*/' | ||
); | ||
}); | ||
functions.add('genCommentTypeColor', function (type, color) { | ||
var comments = []; | ||
switch (type.value) { | ||
case 'text': | ||
comments = ['Set the text color to {0}', '设置文本颜色为 {0}']; | ||
break; | ||
case 'background': | ||
comments = ['Set the background light color to {0}', '设置背景颜色为 {0}']; | ||
break; | ||
case 'hoverBackground': | ||
comments = ['Set the hover background color to {0}', '设置悬停时背景颜色为 {0}']; | ||
break; | ||
} | ||
if (comments.length === 0) return ''; | ||
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.value.substring(1) + '/fff.png&text=+)'; | ||
return ( | ||
'/* AUTOGENERATE: ' + | ||
comments | ||
.map(c => c + imgColor) | ||
.join('|SPLIT|') | ||
.replace(/(\{0\})/g, '"' + color.value + '"') + | ||
'*/' | ||
); | ||
}); | ||
} | ||
}; |
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 |
---|---|---|
@@ -1,57 +1 @@ | ||
.freakMixin() { | ||
@functions: ~`(function() { | ||
function toColorList(list) { | ||
list = list.slice(1, list.length - 1).split(','); | ||
var ret = []; | ||
for (var i = 0, c = list.length; i < c; i++) { | ||
ret.push(list[i].trim().split(' ')); | ||
} | ||
return ret; | ||
} | ||
|
||
var catchColors; | ||
function _initColor(list) { | ||
if (!catchColors) catchColors = toColorList(list); | ||
} | ||
|
||
this.getColor = function(list, name, position) { | ||
_initColor(list); | ||
var ret = ''; | ||
for (var i = 0, c = catchColors.length; i < c; i++) { | ||
if (catchColors[i][0] === name) { | ||
ret = catchColors[i][position - 1]; | ||
break; | ||
} | ||
} | ||
return ret; | ||
} | ||
|
||
this.genComment = function(value, ...comments) { | ||
return '/* AUTOGENERATE: ' + comments.join('|SPLIT|').replace(/(\{0\})/g, '"' + value + '"') + '*/'; | ||
} | ||
|
||
this.genCommentColor = function(color, ...comments) { | ||
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.substring(1) + '/fff.png&text=+)'; | ||
return '/* AUTOGENERATE: ' + comments.map(c => c + imgColor).join('|SPLIT|').replace(/(\{0\})/g, '"' + color + '"') + '*/'; | ||
} | ||
|
||
this.genCommentTypeColor = function(type, color) { | ||
var comments = []; | ||
switch (type) { | ||
case 'text': | ||
comments = ['Set the text color to {0}', '设置文本颜色为 {0}']; | ||
break; | ||
case 'background': | ||
comments = ['Set the background light color to {0}', '设置背景颜色为 {0}']; | ||
break; | ||
case 'hoverBackground': | ||
comments = ['Set the hover background color to {0}', '设置悬停时背景颜色为 {0}']; | ||
break; | ||
} | ||
if (comments.length === 0) return ''; | ||
var imgColor = ' ![Color](https://dummyimage.com/20x20/' + color.substring(1) + '/fff.png&text=+)'; | ||
return '/* AUTOGENERATE: ' + comments.map(c => c + imgColor).join('|SPLIT|').replace(/(\{0\})/g, '"' + color + '"') + '*/'; | ||
} | ||
})()`; | ||
} | ||
.freakMixin(); | ||
@plugin "./_freak"; |
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
Oops, something went wrong.