diff options
Diffstat (limited to 'node_modules/postcss-colormin')
| -rw-r--r-- | node_modules/postcss-colormin/CHANGELOG.md | 107 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/LICENSE-MIT | 22 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/README.md | 59 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/dist/index.js | 78 | ||||
| -rw-r--r-- | node_modules/postcss-colormin/package.json | 59 |
5 files changed, 325 insertions, 0 deletions
diff --git a/node_modules/postcss-colormin/CHANGELOG.md b/node_modules/postcss-colormin/CHANGELOG.md new file mode 100644 index 00000000..8e4e4446 --- /dev/null +++ b/node_modules/postcss-colormin/CHANGELOG.md @@ -0,0 +1,107 @@ +# 2.2.2 + +* Resolves an issue where the module would mangle the non-standard `composes` + property when consumed via css-loader. + +# 2.2.1 + +* Resolves an issue where converting an rgb/hsl function next to another token, + such as `linear-gradient(rgb(10, 10, 10)0%, blue)` would result in a + mangled value. + +# 2.2.0 + +* Adds support for legacy IE versions (< 10). + +# 2.1.8 + +* Fixes incorrect minification of percentages used by `rgb` functions; i.e. + `rgb(100%,100%,100%)` was not converted correctly to `#fff`. + +# 2.1.7 + +* Fixes another regression where `hsla(0,0%,100%,.5)` was converted to + `hsla(0,0%,100%,0.5)`. + +# 2.1.6 + +* Fixes a regression where codes for `rgba` & `hsla` were not correctly + capped at minimum/maximum values. + +# 2.1.5 + +* Fixes several regressions from 2.1.3 - shorthand hex color minification, + incorrect conversion to `transparent` from `rgba(255, 255, 255, 0)` + (thanks to @TrySound). + +# 2.1.4 + +* Fixes an error in the last patch where the `lib` directory was ignored by npm. + +# 2.1.3 + +* Updates postcss-value-parser to version 3 (thanks to @TrySound). +* Removes the dependency on colormin, conversion is now done in-module. + +# 2.1.2 + +* Removed an unnecessary `trim` method that was used to work around a now + resolved issue in PostCSS (thanks to @TrySound). + +# 2.1.1 + +* Fixed a regression that was compressing space around forward slashes in + calc functions. + +# 2.1.0 + +* Better support for minifying colors in legacy CSS gradients, switched to + postcss-value-parser (thanks to @TrySound). + +# 2.0.0 + +* Upgraded to PostCSS 5. + +# 1.2.7 + +* Fixes an issue where IE filter properties were being converted + erroneously (thanks to @faddee). + +# 1.2.6 + +* Fixed a crash when specifying `inherit` as a value + to `-webkit-tap-highlight-color`. + +# 1.2.5 + +* Speed up node iteration by calling `eachDecl` once rather than twice. + +# 1.2.4 + +* Fixed an issue caused by upgrading colormin to use ES6. + +# 1.2.3 + +* Fixed an issue where `-webkit-tap-highlight-color` was being incorrectly + transformed to `transparent`. This is not supported in Safari. + +# 1.2.2 + +* Fixed a bug where the module crashed on parsing comma separated values for + properties such as `box-shadow`. + +# 1.2.1 + +* Extracted each color logic into a function for better readability. + +# 1.2.0 + +* Now uses the PostCSS `4.1` plugin API. + +# 1.1.0 + +* Now supports optimisation of colors in gradient values. + +# 1.0.0 + +* Initial release. diff --git a/node_modules/postcss-colormin/LICENSE-MIT b/node_modules/postcss-colormin/LICENSE-MIT new file mode 100644 index 00000000..fd0e863a --- /dev/null +++ b/node_modules/postcss-colormin/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info) + +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-colormin/README.md b/node_modules/postcss-colormin/README.md new file mode 100644 index 00000000..73a35f63 --- /dev/null +++ b/node_modules/postcss-colormin/README.md @@ -0,0 +1,59 @@ +# [postcss][postcss]-colormin [][ci] [][npm] [][deps] + +> Minify colors in your CSS files with PostCSS. + +## Install + +With [npm](https://npmjs.org/package/postcss-colormin) do: + +``` +npm install postcss-colormin --save +``` + + +## Example + +```js +var postcss = require('postcss') +var colormin = require('postcss-colormin'); + +var css = 'h1 {color: rgba(255, 0, 0, 1)}'; +console.log(postcss(colormin()).process(css).css); + +// => 'h1 {color:red}' +``` + +For more examples see the [tests](src/__tests__/index.js). + + +## API + +### colormin([options]) + +#### options + +##### legacy + +Type: `boolean` +Default: `false` + +Set this to `true` to enable IE < 10 compatibility; the browser chokes on the +`transparent` keyword, so in this mode the conversion from `rgba(0,0,0,0)` +is turned off. + + +## Contributing + +Pull requests are welcome. If you add functionality, then please add unit tests +to cover it. + + +## License + +MIT © [Ben Briggs](http://beneb.info) + + +[ci]: https://travis-ci.org/ben-eb/postcss-colormin +[deps]: https://gemnasium.com/ben-eb/postcss-colormin +[npm]: http://badge.fury.io/js/postcss-colormin +[postcss]: https://github.com/postcss/postcss diff --git a/node_modules/postcss-colormin/dist/index.js b/node_modules/postcss-colormin/dist/index.js new file mode 100644 index 00000000..38de10c9 --- /dev/null +++ b/node_modules/postcss-colormin/dist/index.js @@ -0,0 +1,78 @@ +'use strict'; + +exports.__esModule = true; + +var _postcss = require('postcss'); + +var _postcss2 = _interopRequireDefault(_postcss); + +var _postcssValueParser = require('postcss-value-parser'); + +var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser); + +var _colormin = require('colormin'); + +var _colormin2 = _interopRequireDefault(_colormin); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function reduceWhitespaces(decl) { + decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) { + if (node.type === 'function' || node.type === 'div') { + node.before = node.after = ''; + } + }).toString(); +} + +function walk(parent, callback) { + parent.nodes.forEach(function (node, index) { + var bubble = callback(node, index, parent); + if (node.nodes && bubble !== false) { + walk(node, callback); + } + }); +} + +function transform(decl, opts) { + if (decl.prop === '-webkit-tap-highlight-color') { + if (decl.value === 'inherit' || decl.value === 'transparent') { + return; + } + reduceWhitespaces(decl); + return; + } + if (/^(composes|font|filter)/i.test(decl.prop)) { + return; + } + var ast = (0, _postcssValueParser2.default)(decl.value); + walk(ast, function (node, index, parent) { + if (node.type === 'function') { + if (/^(rgb|hsl)a?$/.test(node.value)) { + var value = node.value; + + node.value = (0, _colormin2.default)((0, _postcssValueParser.stringify)(node), opts); + node.type = 'word'; + var next = parent.nodes[index + 1]; + if (node.value !== value && next && next.type === 'word') { + parent.nodes.splice(index + 1, 0, { type: 'space', value: ' ' }); + } + } else if (node.value === 'calc') { + return false; + } + } else { + node.value = (0, _colormin2.default)(node.value, opts); + } + }); + decl.value = ast.toString(); +} + +exports.default = _postcss2.default.plugin('postcss-colormin', function () { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + return function (css) { + return css.walkDecls(function (node) { + return transform(node, opts); + }); + }; +}); +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/postcss-colormin/package.json b/node_modules/postcss-colormin/package.json new file mode 100644 index 00000000..0a3b6e89 --- /dev/null +++ b/node_modules/postcss-colormin/package.json @@ -0,0 +1,59 @@ +{ + "name": "postcss-colormin", + "version": "2.2.2", + "description": "Minify colors in your CSS files with PostCSS.", + "main": "dist/index.js", + "files": [ + "dist", + "LICENSE-MIT" + ], + "scripts": { + "pretest": "eslint src", + "prepublish": "del-cli dist && babel src --out-dir dist --ignore /__tests__/", + "test": "ava src/__tests__", + "test-012": "ava src/__tests__" + }, + "keywords": [ + "color", + "colors", + "compression", + "css", + "minify", + "postcss", + "postcss-plugin" + ], + "license": "MIT", + "devDependencies": { + "ava": "^0.17.0", + "babel-cli": "^6.3.17", + "babel-core": "^6.3.26", + "babel-plugin-add-module-exports": "^0.2.0", + "babel-preset-es2015": "^6.3.13", + "babel-preset-es2015-loose": "^7.0.0", + "babel-preset-stage-0": "^6.3.13", + "babel-register": "^6.9.0", + "del-cli": "^0.2.0", + "eslint": "^3.0.0", + "eslint-config-cssnano": "^3.0.0", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-import": "^2.0.1" + }, + "homepage": "https://github.com/ben-eb/postcss-colormin", + "author": { + "name": "Ben Briggs", + "email": "beneb.info@gmail.com", + "url": "http://beneb.info" + }, + "repository": "ben-eb/postcss-colormin", + "dependencies": { + "colormin": "^1.0.5", + "postcss": "^5.0.13", + "postcss-value-parser": "^3.2.3" + }, + "eslintConfig": { + "extends": "cssnano" + }, + "ava": { + "require": "babel-register" + } +} |
