From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/postcss-minify-params/CHANGELOG.md | 27 ++++++ node_modules/postcss-minify-params/LICENSE | 20 +++++ node_modules/postcss-minify-params/README.md | 33 +++++++ node_modules/postcss-minify-params/dist/index.js | 106 +++++++++++++++++++++++ node_modules/postcss-minify-params/package.json | 55 ++++++++++++ 5 files changed, 241 insertions(+) create mode 100644 node_modules/postcss-minify-params/CHANGELOG.md create mode 100644 node_modules/postcss-minify-params/LICENSE create mode 100644 node_modules/postcss-minify-params/README.md create mode 100644 node_modules/postcss-minify-params/dist/index.js create mode 100644 node_modules/postcss-minify-params/package.json (limited to 'node_modules/postcss-minify-params') diff --git a/node_modules/postcss-minify-params/CHANGELOG.md b/node_modules/postcss-minify-params/CHANGELOG.md new file mode 100644 index 00000000..7c312dfa --- /dev/null +++ b/node_modules/postcss-minify-params/CHANGELOG.md @@ -0,0 +1,27 @@ +# 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. diff --git a/node_modules/postcss-minify-params/LICENSE b/node_modules/postcss-minify-params/LICENSE new file mode 100644 index 00000000..066ee676 --- /dev/null +++ b/node_modules/postcss-minify-params/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2015 Bogdan Chadkin + +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. diff --git a/node_modules/postcss-minify-params/README.md b/node_modules/postcss-minify-params/README.md new file mode 100644 index 00000000..23c0968d --- /dev/null +++ b/node_modules/postcss-minify-params/README.md @@ -0,0 +1,33 @@ +# 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 diff --git a/node_modules/postcss-minify-params/dist/index.js b/node_modules/postcss-minify-params/dist/index.js new file mode 100644 index 00000000..ce373e9f --- /dev/null +++ b/node_modules/postcss-minify-params/dist/index.js @@ -0,0 +1,106 @@ +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 = ''; + } + }); + }; +}); diff --git a/node_modules/postcss-minify-params/package.json b/node_modules/postcss-minify-params/package.json new file mode 100644 index 00000000..2635f1bb --- /dev/null +++ b/node_modules/postcss-minify-params/package.json @@ -0,0 +1,55 @@ +{ + "name": "postcss-minify-params", + "version": "1.2.2", + "description": "Minify at-rule params with PostCSS", + "keywords": [ + "postcss", + "css", + "postcss-plugin", + "minify", + "optimise", + "params" + ], + "main": "dist/index.js", + "files": [ + "dist" + ], + "author": "Bogdan Chadkin ", + "license": "MIT", + "repository": "ben-eb/postcss-minify-params", + "bugs": { + "url": "https://github.com/ben-eb/postcss-minify-params/issues" + }, + "homepage": "https://github.com/ben-eb/postcss-minify-params", + "dependencies": { + "alphanum-sort": "^1.0.1", + "postcss": "^5.0.2", + "postcss-value-parser": "^3.0.2", + "uniqs": "^2.0.0" + }, + "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" + }, + "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 + } + }, + "nyc": { + "sourceMap": true, + "instrument": true + } +} -- cgit v1.2.3