This commit is contained in:
hatuhn
2019-09-13 09:45:04 +07:00
parent f14a34ba19
commit 558fb07261
16790 changed files with 0 additions and 1642370 deletions

View File

@@ -1,27 +0,0 @@
# 1.2.2
* Resolves an issue where `all and` would be removed from
`@media not all and (conditions) {}`, causing an invalid media query to
be output.
# 1.2.1
* Resolves an issue where `1.2.0` would throw on empty function parentheses.
# 1.2.0
* Adds support for simplifying `min-aspect-ratio` and `max-aspect-ratio`. For
example, `@media (min-aspect-ratio: 1280/720) {}` can be minified to
`@media (min-aspect-ratio:16/9){}`.
# 1.1.0
* Adds support for removing the unnecessary `all and` from media queries.
# 1.0.1
* Refactor to ES6.
# 1.0.0
* Initial release.

View File

@@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright 2015 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.

View File

@@ -1,33 +0,0 @@
# postcss-minify-params [![Build Status][ci-img]][ci]
> Minify at-rule params with PostCSS.
```css
@media only screen and ( min-width: 400px, min-height: 500px ) {
h2{
color:blue
}
}
```
```css
@media only screen and (min-width:400px,min-height:500px) {
h2{
color:blue
}
}
```
## Usage
```js
postcss([ require('postcss-minify-params') ])
```
See [PostCSS] docs for examples for your environment.
MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/ben-eb/postcss-minify-params.svg
[ci]: https://travis-ci.org/ben-eb/postcss-minify-params

View File

@@ -1,106 +0,0 @@
var postcss = require('postcss');
var valueParser = require('postcss-value-parser');
var stringify = valueParser.stringify;
var sort = require('alphanum-sort');
var uniqs = require('uniqs');
/**
* Return the greatest common divisor
* of two numbers.
*/
function gcd(a, b) {
return b ? gcd(b, a % b) : a;
}
function aspectRatio(a, b) {
var divisor = gcd(a, b);
return [a / divisor, b / divisor];
}
function split(nodes, div) {
var result = [];
var i, max, node;
var last = '';
for (i = 0, max = nodes.length; i < max; i += 1) {
node = nodes[i];
if (node.type === 'div' && node.value === div) {
result.push(last);
last = '';
} else {
last += stringify(node);
}
}
result.push(last);
return result;
}
function removeNode(node) {
node.value = '';
node.type = 'word';
}
module.exports = postcss.plugin('postcss-minify-params', function () {
return function (css) {
css.walkAtRules(function (rule) {
if (!rule.params) {
return;
}
var params = valueParser(rule.params);
params.walk(function (node, index) {
if (node.type === 'div' || node.type === 'function') {
node.before = node.after = '';
if (
node.type === 'function' &&
node.nodes[4] &&
node.nodes[0].value.indexOf('-aspect-ratio') === 3
) {
var ref = aspectRatio(
node.nodes[2].value,
node.nodes[4].value
);
var a = ref[0];
var b = ref[1];
node.nodes[2].value = a;
node.nodes[4].value = b;
}
} else if (node.type === 'space') {
node.value = ' ';
} else if (node.type === 'word') {
var prevWord = params.nodes[index - 2];
if (
node.value === 'all' &&
rule.name === 'media' &&
!prevWord
) {
var nextSpace = params.nodes[index + 1];
var nextWord = params.nodes[index + 2];
var secondSpace = params.nodes[index + 3];
if (nextWord && nextWord.value === 'and') {
removeNode(nextWord);
removeNode(nextSpace);
if (secondSpace) {
removeNode(secondSpace);
}
}
removeNode(node);
}
}
}, true);
rule.params = sort(uniqs(split(params.nodes, ',')), {
insensitive: true
}).join();
if (!rule.params.length) {
rule.raws.afterName = '';
}
});
};
});

View File

@@ -1,86 +0,0 @@
{
"_from": "postcss-minify-params@^1.0.4",
"_id": "postcss-minify-params@1.2.2",
"_inBundle": false,
"_integrity": "sha1-rSzgcTc7lDs9kwo/pZo1jCjW8fM=",
"_location": "/postcss-minify-params",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "postcss-minify-params@^1.0.4",
"name": "postcss-minify-params",
"escapedName": "postcss-minify-params",
"rawSpec": "^1.0.4",
"saveSpec": null,
"fetchSpec": "^1.0.4"
},
"_requiredBy": [
"/cssnano"
],
"_resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-1.2.2.tgz",
"_shasum": "ad2ce071373b943b3d930a3fa59a358c28d6f1f3",
"_spec": "postcss-minify-params@^1.0.4",
"_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/ben-eb/postcss-minify-params/issues"
},
"bundleDependencies": false,
"dependencies": {
"alphanum-sort": "^1.0.1",
"postcss": "^5.0.2",
"postcss-value-parser": "^3.0.2",
"uniqs": "^2.0.0"
},
"deprecated": false,
"description": "Minify at-rule params with PostCSS",
"devDependencies": {
"buble": "^0.12.5",
"cross-env": "^2.0.0",
"del-cli": "^0.2.0",
"eslint": "^2.13.1",
"eslint-config-postcss": "^2.0.2",
"mocha": "^2.5.3",
"nyc": "^7.0.0"
},
"eslintConfig": {
"extends": "postcss",
"env": {
"mocha": true
}
},
"files": [
"dist"
],
"homepage": "https://github.com/ben-eb/postcss-minify-params",
"keywords": [
"postcss",
"css",
"postcss-plugin",
"minify",
"optimise",
"params"
],
"license": "MIT",
"main": "dist/index.js",
"name": "postcss-minify-params",
"nyc": {
"sourceMap": true,
"instrument": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/ben-eb/postcss-minify-params.git"
},
"scripts": {
"prepublish": "del-cli dist && cross-env BABEL_ENV=publish buble src -o dist",
"pretest": "eslint src",
"report": "nyc report --reporter=html",
"test": "cross-env BABEL_ENV=test nyc mocha test --compilers js:buble/register"
},
"version": "1.2.2"
}