aboutsummaryrefslogtreecommitdiff
path: root/node_modules/clean-css/lib/optimizer/restore-from-optimizing.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:43:05 +0800
committerruki <waruqi@gmail.com>2018-11-07 22:18:30 +0800
commit89e95b3f143682ed9a006991bacf45c9dcba4818 (patch)
tree4f44cf41b828577d583890bdd5a1c31e8491a6ba /node_modules/clean-css/lib/optimizer/restore-from-optimizing.js
parentaa7f0199255277949790b41c56e8ec97dd4f0da4 (diff)
downloadxmake-docs-vuepress.tar.gz
xmake-docs-vuepress.zip
remove node_modulesvuepress
Diffstat (limited to 'node_modules/clean-css/lib/optimizer/restore-from-optimizing.js')
-rw-r--r--node_modules/clean-css/lib/optimizer/restore-from-optimizing.js69
1 files changed, 0 insertions, 69 deletions
diff --git a/node_modules/clean-css/lib/optimizer/restore-from-optimizing.js b/node_modules/clean-css/lib/optimizer/restore-from-optimizing.js
deleted file mode 100644
index ebd69c2a..00000000
--- a/node_modules/clean-css/lib/optimizer/restore-from-optimizing.js
+++ /dev/null
@@ -1,69 +0,0 @@
-var Hack = require('./hack');
-
-var Marker = require('../tokenizer/marker');
-
-var ASTERISK_HACK = '*';
-var BACKSLASH_HACK = '\\';
-var IMPORTANT_TOKEN = '!important';
-var UNDERSCORE_HACK = '_';
-var BANG_HACK = '!ie';
-
-function restoreFromOptimizing(properties, restoreCallback) {
- var property;
- var restored;
- var current;
- var i;
-
- for (i = properties.length - 1; i >= 0; i--) {
- property = properties[i];
-
- if (property.unused) {
- continue;
- }
-
- if (!property.dirty && !property.important && !property.hack) {
- continue;
- }
-
- if (restoreCallback) {
- restored = restoreCallback(property);
- property.value = restored;
- } else {
- restored = property.value;
- }
-
- if (property.important) {
- restoreImportant(property);
- }
-
- if (property.hack) {
- restoreHack(property);
- }
-
- if ('all' in property) {
- current = property.all[property.position];
- current[1][1] = property.name;
-
- current.splice(2, current.length - 1);
- Array.prototype.push.apply(current, restored);
- }
- }
-}
-
-function restoreImportant(property) {
- property.value[property.value.length - 1][1] += IMPORTANT_TOKEN;
-}
-
-function restoreHack(property) {
- if (property.hack[0] == Hack.UNDERSCORE) {
- property.name = UNDERSCORE_HACK + property.name;
- } else if (property.hack[0] == Hack.ASTERISK) {
- property.name = ASTERISK_HACK + property.name;
- } else if (property.hack[0] == Hack.BACKSLASH) {
- property.value[property.value.length - 1][1] += BACKSLASH_HACK + property.hack[1];
- } else if (property.hack[0] == Hack.BANG) {
- property.value[property.value.length - 1][1] += Marker.SPACE + BANG_HACK;
- }
-}
-
-module.exports = restoreFromOptimizing;