uapte
This commit is contained in:
22
node_modules/postcss-minify-font-values/LICENSE
generated
vendored
22
node_modules/postcss-minify-font-values/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
Copyright (c) Bogdan Chadkin <trysound@yandex.ru>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
75
node_modules/postcss-minify-font-values/README.md
generated
vendored
75
node_modules/postcss-minify-font-values/README.md
generated
vendored
@@ -1,75 +0,0 @@
|
||||
# postcss-minify-font-values [![Build Status][ci-img]][ci]
|
||||
|
||||
> Minify font declarations with PostCSS.
|
||||
|
||||
This module will try to minimise the `font-family`, `font-weight` and `font` shorthand
|
||||
properties; it can unquote font families where necessary, detect & remove
|
||||
duplicates, and cut short a declaration after it finds a keyword. For more
|
||||
examples, see the [tests](test).
|
||||
|
||||
```css
|
||||
h1 {
|
||||
font:bold 2.2rem/.9 "Open Sans Condensed", sans-serif;
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: "Helvetica Neue", Arial, sans-serif, Helvetica;
|
||||
font-weight: normal;
|
||||
}
|
||||
```
|
||||
|
||||
```css
|
||||
h1 {
|
||||
font:700 2.2rem/.9 Open Sans Condensed,sans-serif
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: Helvetica Neue,Arial,sans-serif;
|
||||
font-weight: 400;
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### minifyFontValues([options])
|
||||
|
||||
#### options
|
||||
|
||||
##### removeAfterKeyword
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Pass `false` to disable the module from removing font families after it
|
||||
encounters a font keyword, for example `sans-serif`.
|
||||
|
||||
##### removeDuplicates
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Pass `false` to disable the module from removing duplicated font families.
|
||||
|
||||
##### removeQuotes
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Pass `false` to disable the module from removing quotes from font families.
|
||||
Note that oftentimes, this is a *safe optimisation* & is done safely. For more
|
||||
details, see [Mathias Bynens' article][mathias].
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
postcss([ require('postcss-minify-font-values') ])
|
||||
```
|
||||
|
||||
See [PostCSS] docs for examples for your environment.
|
||||
|
||||
MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
|
||||
|
||||
[mathias]: https://mathiasbynens.be/notes/unquoted-font-family
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
[ci-img]: https://travis-ci.org/TrySound/postcss-minify-font-values.svg
|
||||
[ci]: https://travis-ci.org/TrySound/postcss-minify-font-values
|
||||
38
node_modules/postcss-minify-font-values/index.js
generated
vendored
38
node_modules/postcss-minify-font-values/index.js
generated
vendored
@@ -1,38 +0,0 @@
|
||||
var assign = require('object-assign');
|
||||
var postcss = require('postcss');
|
||||
var valueParser = require('postcss-value-parser');
|
||||
var minifyWeight = require('./lib/minify-weight');
|
||||
var minifyFamily = require('./lib/minify-family');
|
||||
var minifyFont = require('./lib/minify-font');
|
||||
|
||||
function transform(opts) {
|
||||
opts = assign({
|
||||
removeAfterKeyword: true,
|
||||
removeDuplicates: true,
|
||||
removeQuotes: true
|
||||
}, opts);
|
||||
|
||||
return function (decl) {
|
||||
var tree;
|
||||
|
||||
if (decl.type === 'decl') {
|
||||
if (decl.prop === 'font-weight') {
|
||||
decl.value = minifyWeight(decl.value, opts);
|
||||
} else if (decl.prop === 'font-family') {
|
||||
tree = valueParser(decl.value);
|
||||
tree.nodes = minifyFamily(tree.nodes, opts);
|
||||
decl.value = tree.toString();
|
||||
} else if (decl.prop === 'font') {
|
||||
tree = valueParser(decl.value);
|
||||
tree.nodes = minifyFont(tree.nodes, opts);
|
||||
decl.value = tree.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = postcss.plugin('postcss-minify-font-values', function (opts) {
|
||||
return function (css) {
|
||||
css.walk(transform(opts));
|
||||
};
|
||||
});
|
||||
44
node_modules/postcss-minify-font-values/lib/keywords.js
generated
vendored
44
node_modules/postcss-minify-font-values/lib/keywords.js
generated
vendored
@@ -1,44 +0,0 @@
|
||||
var keywords = module.exports = {
|
||||
style: [
|
||||
'italic',
|
||||
'oblique'
|
||||
],
|
||||
variant: [
|
||||
'small-caps'
|
||||
],
|
||||
weight: [
|
||||
'100',
|
||||
'200',
|
||||
'300',
|
||||
'400',
|
||||
'500',
|
||||
'600',
|
||||
'700',
|
||||
'800',
|
||||
'900',
|
||||
'bold',
|
||||
'lighter',
|
||||
'bolder'
|
||||
],
|
||||
stretch: [
|
||||
'ultra-condensed',
|
||||
'extra-condensed',
|
||||
'condensed',
|
||||
'semi-condensed',
|
||||
'semi-expanded',
|
||||
'expanded',
|
||||
'extra-expanded',
|
||||
'ultra-expanded'
|
||||
],
|
||||
size: [
|
||||
'xx-small',
|
||||
'x-small',
|
||||
'small',
|
||||
'medium',
|
||||
'large',
|
||||
'x-large',
|
||||
'xx-large',
|
||||
'larger',
|
||||
'smaller'
|
||||
]
|
||||
};
|
||||
101
node_modules/postcss-minify-font-values/lib/minify-family.js
generated
vendored
101
node_modules/postcss-minify-font-values/lib/minify-family.js
generated
vendored
@@ -1,101 +0,0 @@
|
||||
var stringify = require('postcss-value-parser').stringify;
|
||||
var uniqs = require('./uniqs')('monospace');
|
||||
|
||||
// Note that monospace is missing intentionally from this list; we should not
|
||||
// remove instances of duplicated monospace keywords, it causes the font to be
|
||||
// rendered smaller in Chrome.
|
||||
|
||||
var keywords = [
|
||||
'sans-serif',
|
||||
'serif',
|
||||
'fantasy',
|
||||
'cursive'
|
||||
];
|
||||
|
||||
function intersection(haystack, array) {
|
||||
return array.some(function (v) {
|
||||
return ~haystack.indexOf(v);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = function (nodes, opts) {
|
||||
var family = [];
|
||||
var last = null;
|
||||
var i, max;
|
||||
|
||||
nodes.forEach(function (node, index, nodes) {
|
||||
var value = node.value;
|
||||
|
||||
if (node.type === 'string' || node.type === 'function') {
|
||||
family.push(node);
|
||||
} else if (node.type === 'word') {
|
||||
if (!last) {
|
||||
last = { type: 'word', value: '' };
|
||||
family.push(last);
|
||||
}
|
||||
|
||||
last.value += node.value;
|
||||
} else if (node.type === 'space') {
|
||||
if (last && index !== nodes.length - 1) {
|
||||
last.value += ' ';
|
||||
}
|
||||
} else {
|
||||
last = null;
|
||||
}
|
||||
});
|
||||
|
||||
family = family.map(function (node) {
|
||||
if (node.type === 'string') {
|
||||
if (
|
||||
!opts.removeQuotes ||
|
||||
intersection(node.value, keywords) ||
|
||||
/[0-9]/.test(node.value.slice(0, 1))
|
||||
) {
|
||||
return stringify(node);
|
||||
}
|
||||
|
||||
var escaped = node.value.split(/\s/).map(function (word, index, words) {
|
||||
var next = words[index + 1];
|
||||
if (next && /^[^a-z]/i.test(next)) {
|
||||
return word + '\\';
|
||||
}
|
||||
|
||||
if (!/^[^a-z\d\xa0-\uffff_-]/i.test(word)) {
|
||||
return word.replace(/([^a-z\d\xa0-\uffff_-])/gi, '\\$1');
|
||||
}
|
||||
|
||||
if (/^[^a-z]/i.test(word) && index < 1) {
|
||||
return '\\' + word;
|
||||
}
|
||||
|
||||
return word;
|
||||
}).join(' ');
|
||||
|
||||
if (escaped.length < node.value.length + 2) {
|
||||
return escaped;
|
||||
}
|
||||
}
|
||||
|
||||
return stringify(node);
|
||||
});
|
||||
|
||||
if (opts.removeAfterKeyword) {
|
||||
for (i = 0, max = family.length; i < max; i += 1) {
|
||||
if (~keywords.indexOf(family[i])) {
|
||||
family = family.slice(0, i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.removeDuplicates) {
|
||||
family = uniqs(family);
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
type: 'word',
|
||||
value: family.join()
|
||||
}
|
||||
];
|
||||
};
|
||||
50
node_modules/postcss-minify-font-values/lib/minify-font.js
generated
vendored
50
node_modules/postcss-minify-font-values/lib/minify-font.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
var unit = require('postcss-value-parser').unit;
|
||||
var keywords = require('./keywords');
|
||||
var minifyFamily = require('./minify-family');
|
||||
var minifyWeight = require('./minify-weight');
|
||||
|
||||
module.exports = function (nodes, opts) {
|
||||
var i, max, node, familyStart, family;
|
||||
var hasSize = false;
|
||||
|
||||
for (i = 0, max = nodes.length; i < max; i += 1) {
|
||||
node = nodes[i];
|
||||
if (node.type === 'word') {
|
||||
if (node.value === 'normal' ||
|
||||
~keywords.style.indexOf(node.value) ||
|
||||
~keywords.variant.indexOf(node.value) ||
|
||||
~keywords.stretch.indexOf(node.value)) {
|
||||
if (!hasSize) {
|
||||
familyStart = i;
|
||||
}
|
||||
} else if (~keywords.weight.indexOf(node.value)) {
|
||||
if (!hasSize) {
|
||||
node.value = minifyWeight(node.value, opts);
|
||||
familyStart = i;
|
||||
}
|
||||
} else if (~keywords.size.indexOf(node.value) || unit(node.value)) {
|
||||
if (!hasSize) {
|
||||
familyStart = i;
|
||||
hasSize = true;
|
||||
}
|
||||
}
|
||||
} else if (node.type === 'div') {
|
||||
node.before = '';
|
||||
node.after = '';
|
||||
if (node.value === '/') {
|
||||
familyStart = i + 1;
|
||||
}
|
||||
break;
|
||||
} else if (node.type === 'space') {
|
||||
node.value = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
if (!isNaN(familyStart)) {
|
||||
familyStart += 2;
|
||||
family = minifyFamily(nodes.slice(familyStart), opts);
|
||||
nodes = nodes.slice(0, familyStart).concat(family);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
};
|
||||
3
node_modules/postcss-minify-font-values/lib/minify-weight.js
generated
vendored
3
node_modules/postcss-minify-font-values/lib/minify-weight.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
module.exports = function (value) {
|
||||
return value === 'normal' ? '400' : value === 'bold' ? '700' : value;
|
||||
};
|
||||
11
node_modules/postcss-minify-font-values/lib/uniqs.js
generated
vendored
11
node_modules/postcss-minify-font-values/lib/uniqs.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
module.exports = function uniqueExcept (exclude) {
|
||||
return function unique () {
|
||||
var list = Array.prototype.concat.apply([], arguments);
|
||||
return list.filter(function (item, i) {
|
||||
if (item === exclude) {
|
||||
return true;
|
||||
}
|
||||
return i === list.indexOf(item);
|
||||
});
|
||||
};
|
||||
};
|
||||
70
node_modules/postcss-minify-font-values/package.json
generated
vendored
70
node_modules/postcss-minify-font-values/package.json
generated
vendored
@@ -1,70 +0,0 @@
|
||||
{
|
||||
"_from": "postcss-minify-font-values@^1.0.2",
|
||||
"_id": "postcss-minify-font-values@1.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-S1jttWZB66fIR0qzUmyv17vey2k=",
|
||||
"_location": "/postcss-minify-font-values",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postcss-minify-font-values@^1.0.2",
|
||||
"name": "postcss-minify-font-values",
|
||||
"escapedName": "postcss-minify-font-values",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssnano"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-1.0.5.tgz",
|
||||
"_shasum": "4b58edb56641eba7c8474ab3526cafd7bbdecb69",
|
||||
"_spec": "postcss-minify-font-values@^1.0.2",
|
||||
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/t-latehome/wp-content/plugins/opal-estate-pro/node_modules/cssnano",
|
||||
"author": {
|
||||
"name": "Bogdan Chadkin",
|
||||
"email": "trysound@yandex.ru"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/TrySound/postcss-minify-font-values/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"object-assign": "^4.0.1",
|
||||
"postcss": "^5.0.4",
|
||||
"postcss-value-parser": "^3.0.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Minify font declarations with PostCSS",
|
||||
"devDependencies": {
|
||||
"eslint": "^1.3.1",
|
||||
"tap-spec": "^4.1.0",
|
||||
"tape": "^4.2.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/TrySound/postcss-minify-font-values",
|
||||
"keywords": [
|
||||
"css",
|
||||
"font",
|
||||
"font-family",
|
||||
"font-weight",
|
||||
"optimise",
|
||||
"postcss-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "postcss-minify-font-values",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/TrySound/postcss-minify-font-values.git"
|
||||
},
|
||||
"scripts": {
|
||||
"posttest": "eslint index.js lib test",
|
||||
"test": "tape test/*.js | tap-spec"
|
||||
},
|
||||
"version": "1.0.5"
|
||||
}
|
||||
Reference in New Issue
Block a user