Removed GopherJS, basic frontend completed, need backend changes for

torrent storage
This commit is contained in:
2017-11-30 18:12:11 -05:00
parent 67fdef16b1
commit e98ad2cc88
69321 changed files with 5498914 additions and 337 deletions

View File

@@ -0,0 +1,354 @@
# 3.10.0
* cssnano will no longer `console.warn` any messages when using deprecated
options; these are now sent to PostCSS. You will be able to see them if you
use a PostCSS runner with built-in messages support, or alternately by
loading `postcss-reporter` or `postcss-browser-reporter` in your plugins list.
* Prepares support for `grid` identifier reduction by adding it to the list
of optimisations turned off when `options.safe` is set to `true`.
* Adds support for normalizing `unicode-range` descriptors. Values will
be converted when the code matches `0` & `f` in the same place on both sides
of the range. So, `u+2000-2fff` can be converted to `u+2???`, but
`u+2100-2fff` will be left as it is.
# 3.9.1
* Resolves an integration issue with `v3.9.0`, where `undefined` values
would attempt to be parsed.
# 3.9.0
* Adds a new option to normalize wrapping quotes for strings & joining
multiple-line strings into a single line. This optimisation can potentially
reduce the final gzipped size of your CSS file.
# 3.8.2
* Resolves an issue where `display: list-item inline flow` would be normalized
to `inline list-item` rather than `inline-list-item` (thanks to @mattbasta).
# 3.8.1
* Adds a quick start file for easy integration with Runkit. Try cssnano online
at https://runkit.com/npm/cssnano.
# 3.8.0
* Adds support for normalizing multiple values for the `display` property. For
example `block flow` can be simplified to `block`.
# 3.7.7
* Further improves CSS mixin handling; semicolons will no longer be stripped
from *rules* as well as declarations.
# 3.7.6
* Resolves an issue where the semicolon was being incorrectly stripped
from CSS mixins.
# 3.7.5
* Resolves an issue where the `safe` flag was not being persisted across
multiple files (thanks to @techmatt101).
# 3.7.4
* Improves performance of the reducePositions transform by testing
against `hasOwnProperty` instead of using an array of object keys.
* Removes the redundant `indexes-of` dependency.
# 3.7.3
* Unpins postcss-filter-plugins from `2.0.0` as a fix has landed in the new
version of uniqid.
# 3.7.2
* Temporarily pins postcss-filter-plugins to version `2.0.0` in order to
mitigate an issue with uniqid `3.0.0`.
# 3.7.1
* Enabling safe mode now turns off both postcss-merge-idents &
postcss-normalize-url's `stripWWW` option.
# 3.7.0
* Added: Reduce `background-repeat` definitions; works with both this property
& the `background` shorthand, and aims to compress the extended two value
syntax into the single value syntax.
* Added: Reduce `initial` values for properties when the *actual* initial value
is shorter; for example, `min-width: initial` becomes `min-width: 0`.
# 3.6.2
* Fixed an issue where cssnano would crash on `steps(1)`.
# 3.6.1
* Fixed an issue where cssnano would crash on `steps` functions with a
single argument.
# 3.6.0
* Added `postcss-discard-overridden` to safely discard overridden rules with
the same identifier (thanks to @Justineo).
* Added: Reduce animation/transition timing functions. Detects `cubic-bezier`
functions that are equivalent to the timing keywords and compresses, as well
as normalizing the `steps` timing function.
* Added the `perspective-origin` property to the list of supported properties
transformed by the `reduce-positions` transform.
# 3.5.2
* Resolves an issue where the 3 or 4 value syntax for `background-position`
were being incorrectly converted.
# 3.5.1
* Improves checking for `background-position` values in the `background`
shorthand property.
# 3.5.0
* Adds a new optimisation path which can minimise keyword values for
`background-position` and the `background` shorthand.
* Tweaks to performance in the `core` module, now performs less AST passes.
* Now compiled with Babel 6.
# 3.4.0
* Adds a new optimisation path which can minimise gradient parameters
automatically.
# 3.3.2
* Fixes an issue where using `options.safe` threw an error when cssnano was
not used as part of a PostCSS instance, but standalone (such as in modules
like gulp-cssnano). cssnano now renames `safe` internally to `isSafe`.
# 3.3.1
* Unpins postcss-colormin from `2.1.2`, as the `2.1.3` & `2.1.4` patches had
optimization regressions that are now resolved in `2.1.5`.
# 3.3.0
* Updated modules to use postcss-value-parser version 3 (thanks to @TrySound).
* Now converts between transform functions with postcss-reduce-transforms.
e.g. `translate3d(0, 0, 0)` becomes `translateZ(0)`.
# 3.2.0
* cssnano no longer converts `outline: none` to `outline: 0`, as there are
some cases where the values are not equivalent (thanks to @TrySound).
* cssnano no longer converts for example `16px` to `1pc` *by default*. Length
optimisations can be turned on via `{convertValues: {length: true}}`.
* Improved minimization of css functions (thanks to @TrySound).
# 3.1.0
* This release swaps postcss-single-charset for postcss-normalize-charset,
which can detect encoding to determine whether a charset is necessary.
Optionally, you can set the `add` option to `true` to prepend a UTF-8
charset to the output automatically (thanks to @TrySound).
* A `safe` option was added, which disables more aggressive optimisations, as
a convenient preset configuration (thanks to @TrySound).
* Added an option to convert from `deg` to `turn` & vice versa, & improved
minification performance in functions (thanks to @TrySound).
# 3.0.3
* Fixes an issue where cssnano was removing spaces around forward slashes in
string literals (thanks to @TrySound).
# 3.0.2
* Fixes an issue where cssnano was removing spaces around forward slashes in
calc functions.
# 3.0.1
* Replaced css-list & balanced-match with postcss-value-parser, reducing the
module's overall size (thanks to @TrySound).
# 3.0.0
* All cssnano plugins and cssnano itself have migrated to PostCSS 5.x. Please
make sure that when using the 3.x releases that you use a 5.x compatible
PostCSS runner.
* cssnano will now compress inline SVG through SVGO. Because of this change,
interfacing with cssnano must now be done through an asynchronous API. The
main `process` method has the same signature as a PostCSS processor instance.
* The old options such as `merge` & `fonts` that were deprecated in
release `2.5.0` were removed. The new architecture allows you to specify any
module name to disable it.
* postcss-minify-selectors' at-rule compression was extracted out into
postcss-minify-params (thanks to @TrySound).
* Overall performance of the module has improved dramatically, thanks to work
by @TrySound and input from the community.
* Improved selector merging/deduplication in certain use cases.
* cssnano no longer compresses hex colours in filter properties, to better
support old versions of Internet Explorer (thanks to @faddee).
* cssnano will not merge properties together that have an `inherit` keyword.
* postcss-minify-font-weight & postcss-font-family were consolidated into
postcss-minify-font-values. Using the old options will print deprecation
warnings (thanks to @TrySound).
* The cssnano CLI was extracted into a separate module, so that dependent
modules such as gulp-cssnano don't download unnecessary extras.
# 2.6.1
* Improved performance of the core module `functionOptimiser`.
# 2.6.0
* Adds a new optimisation which re-orders properties that accept values in
an arbitrary order. This can lead to improved merging behaviour in certain
cases.
# 2.5.0
* Adds support for disabling modules of the user's choosing, with new option
names. The old options (such as `merge` & `fonts`) will be removed in `3.0`.
# 2.4.0
* postcss-minify-selectors was extended to add support for conversion of
`::before` to `:before`; this release removes the dedicated
postcss-pseudoelements module.
# 2.3.0
* Consolidated postcss-minify-trbl & two integrated modules into
postcss-merge-longhand.
# 2.2.0
* Replaced integrated plugin filter with postcss-filter-plugins.
* Improved rule merging logic.
* Improved performance across the board by reducing AST iterations where it
was possible to do so.
* cssnano will now perform better whitespace compression when used with other
PostCSS plugins.
# 2.1.1
* Fixes an issue where options were not passed to normalize-url.
# 2.1.0
* Allow `postcss-font-family` to be disabled.
# 2.0.3
* cssnano can now be consumed with the parentheses-less method in PostCSS; e.g.
`postcss([ cssnano ])`.
* Fixes an issue where 'Din' was being picked up by the logic as a numeric
value, causing the full font name to be incorrectly rearranged.
# 2.0.2
* Extract trbl value reducing into a separate module.
* Refactor core longhand optimiser to not rely on trbl cache.
* Adds support for `ch` units; previously they were removed.
* Fixes parsing of some selector hacks.
* Fixes an issue where embedded base 64 data was being converted as if it were
a URL.
# 2.0.1
* Add `postcss-plugin` keyword to package.json.
* Wraps all core processors with the PostCSS 4.1 plugin API.
# 2.0.0
* Adds removal of outdated vendor prefixes based on browser support.
* Addresses an issue where relative path separators were converted to
backslashes on Windows.
* cssnano will now detect previous plugins and silently disable them when the
functionality overlaps. This is to enable faster interoperation with cssnext.
* cssnano now exports as a PostCSS plugin. The simple interface is exposed
at `cssnano.process(css, opts)` instead of `cssnano(css, opts)`.
* Improved URL detection when using two or more in the same declaration.
* node 0.10 is no longer officially supported.
# 1.4.3
* Fixes incorrect minification of `background:none` to `background:0 0`.
# 1.4.2
* Fixes an issue with nested URLs inside `url()` functions.
# 1.4.1
* Addresses an issue where whitespace removal after a CSS function would cause
rendering issues in Internet Explorer.
# 1.4.0
* Adds support for removal of unused `@keyframes` and `@counter-style` at-rules.
* comments: adds support for user-directed removal of comments, with the
`remove` option (thanks to @dmitrykiselyov).
* comments: `removeAllButFirst` now operates on each CSS tree, rather than the
first one passed to cssnano.
# 1.3.3
* Fixes incorrect minification of `border:none` to `border:0 0`.
# 1.3.2
* Improved selector minifying logic, leading to better compression of attribute
selectors.
* Improved comment discarding logic.
# 1.3.1
* Fixes crash on undefined `decl.before` from prior AST.
# 1.3.0
* Added support for bundling cssnano using webpack (thanks to @MoOx).
# 1.2.1
* Fixed a bug where a CSS function keyword inside its value would throw
an error.
# 1.2.0
* Better support for merging properties without the existance of a shorthand
override.
* Can now 'merge forward' adjacent rules as well as the previous 'merge behind'
behaviour, leading to better compression.
* Selector re-ordering now happens last in the chain of plugins, to help clean
up merged selectors.
# 1.1.0
* Now can merge identifiers such as `@keyframes` and `@counter-style` if they
have duplicated properties but are named differently.
* Fixes an issue where duplicated keyframes with the same name would cause
an infinite loop.
# 1.0.2
* Improve module loading logic (thanks to @tunnckoCore).
* Improve minification of numeric values, with better support for `rem`,
trailing zeroes and slash/comma separated values
(thanks to @TrySound & @tunnckoCore).
* Fixed an issue where `-webkit-tap-highlight-color` values were being
incorrectly transformed to `transparent`. This is not supported in Safari.
* Added support for viewport units (thanks to @TrySound).
* Add MIT license file.
# 1.0.1
* Add repository/author links to package.json.
# 1.0.0
* Initial release.

View File

@@ -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.

View File

@@ -0,0 +1,56 @@
<h1 align="center">
<br>
<img width="360" src="https://rawgit.com/ben-eb/cssnano/master/media/logo.svg" alt="cssnano">
<br>
<br>
<br>
</h1>
> A modular minifier, built on top of the [PostCSS] ecosystem.
[![Build Status](https://travis-ci.org/ben-eb/cssnano.svg?branch=master)][ci] [![Build status](https://ci.appveyor.com/api/projects/status/t1chyvhobtju7jy8/branch/master?svg=true)](https://ci.appveyor.com/project/ben-eb/cssnano/branch/master) [![Coverage Status](https://coveralls.io/repos/github/ben-eb/cssnano/badge.svg?branch=master)](https://coveralls.io/github/ben-eb/cssnano?branch=master) [![NPM version](https://badge.fury.io/js/cssnano.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/cssnano.svg)][deps] [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/ben-eb/cssnano?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
cssnano is a modular minifier that aims to utilise small modules from the
PostCSS ecosystem, rather than being an all-encompassing module that may be
difficult to contribute to. Because it is written on top of PostCSS, it is able
to do more than simple whitespace transforms - including advanced optimisations
such as custom identifier reduction, `z-index` rebasing, and adjacent selector
merging.
Note that cssnano enables aggressive optimisations by default, which might not
always be what you want. Set `options.safe` to `true` if you want to disable
this. In future versions, only safe options will be enabled by default, starting
from [version 4][v4].
For further details check out the [website](http://cssnano.co/):
* [Installation guide for your build process](http://cssnano.co/usage/).
* [Full list of optimisations](http://cssnano.co/optimisations/).
* [Customise the output (options documentation)](http://cssnano.co/options/).
You can now [try cssnano online](https://runkit.com/npm/cssnano) via Runkit!
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
## Links
Please help to support this project by [purchasing a cssnano sticker][sticker].
[sticker]: https://www.stickermule.com/uk/marketplace/11086-cssnano
## License
MIT © [Ben Briggs](http://beneb.info)
[PostCSS]: https://github.com/postcss/postcss
[ci]: https://travis-ci.org/ben-eb/cssnano
[deps]: https://gemnasium.com/ben-eb/cssnano
[npm]: http://badge.fury.io/js/cssnano
[v4]: https://github.com/ben-eb/cssnano/issues/88

View File

@@ -0,0 +1,310 @@
'use strict';
exports.__esModule = true;
var _decamelize = require('decamelize');
var _decamelize2 = _interopRequireDefault(_decamelize);
var _defined = require('defined');
var _defined2 = _interopRequireDefault(_defined);
var _objectAssign = require('object-assign');
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _postcss = require('postcss');
var _postcss2 = _interopRequireDefault(_postcss);
var _postcssFilterPlugins2 = require('postcss-filter-plugins');
var _postcssFilterPlugins3 = _interopRequireDefault(_postcssFilterPlugins2);
var _postcssDiscardComments = require('postcss-discard-comments');
var _postcssDiscardComments2 = _interopRequireDefault(_postcssDiscardComments);
var _postcssReduceInitial = require('postcss-reduce-initial');
var _postcssReduceInitial2 = _interopRequireDefault(_postcssReduceInitial);
var _postcssMinifyGradients = require('postcss-minify-gradients');
var _postcssMinifyGradients2 = _interopRequireDefault(_postcssMinifyGradients);
var _postcssSvgo = require('postcss-svgo');
var _postcssSvgo2 = _interopRequireDefault(_postcssSvgo);
var _postcssReduceTransforms = require('postcss-reduce-transforms');
var _postcssReduceTransforms2 = _interopRequireDefault(_postcssReduceTransforms);
var _autoprefixer = require('autoprefixer');
var _autoprefixer2 = _interopRequireDefault(_autoprefixer);
var _postcssZindex = require('postcss-zindex');
var _postcssZindex2 = _interopRequireDefault(_postcssZindex);
var _postcssConvertValues = require('postcss-convert-values');
var _postcssConvertValues2 = _interopRequireDefault(_postcssConvertValues);
var _postcssCalc = require('postcss-calc');
var _postcssCalc2 = _interopRequireDefault(_postcssCalc);
var _postcssColormin = require('postcss-colormin');
var _postcssColormin2 = _interopRequireDefault(_postcssColormin);
var _postcssOrderedValues = require('postcss-ordered-values');
var _postcssOrderedValues2 = _interopRequireDefault(_postcssOrderedValues);
var _postcssMinifySelectors = require('postcss-minify-selectors');
var _postcssMinifySelectors2 = _interopRequireDefault(_postcssMinifySelectors);
var _postcssMinifyParams = require('postcss-minify-params');
var _postcssMinifyParams2 = _interopRequireDefault(_postcssMinifyParams);
var _postcssNormalizeCharset = require('postcss-normalize-charset');
var _postcssNormalizeCharset2 = _interopRequireDefault(_postcssNormalizeCharset);
var _postcssMinifyFontValues = require('postcss-minify-font-values');
var _postcssMinifyFontValues2 = _interopRequireDefault(_postcssMinifyFontValues);
var _postcssDiscardUnused = require('postcss-discard-unused');
var _postcssDiscardUnused2 = _interopRequireDefault(_postcssDiscardUnused);
var _postcssNormalizeUrl = require('postcss-normalize-url');
var _postcssNormalizeUrl2 = _interopRequireDefault(_postcssNormalizeUrl);
var _postcssMergeIdents = require('postcss-merge-idents');
var _postcssMergeIdents2 = _interopRequireDefault(_postcssMergeIdents);
var _postcssReduceIdents = require('postcss-reduce-idents');
var _postcssReduceIdents2 = _interopRequireDefault(_postcssReduceIdents);
var _postcssMergeLonghand = require('postcss-merge-longhand');
var _postcssMergeLonghand2 = _interopRequireDefault(_postcssMergeLonghand);
var _postcssDiscardDuplicates = require('postcss-discard-duplicates');
var _postcssDiscardDuplicates2 = _interopRequireDefault(_postcssDiscardDuplicates);
var _postcssDiscardOverridden = require('postcss-discard-overridden');
var _postcssDiscardOverridden2 = _interopRequireDefault(_postcssDiscardOverridden);
var _postcssMergeRules = require('postcss-merge-rules');
var _postcssMergeRules2 = _interopRequireDefault(_postcssMergeRules);
var _postcssDiscardEmpty = require('postcss-discard-empty');
var _postcssDiscardEmpty2 = _interopRequireDefault(_postcssDiscardEmpty);
var _postcssUniqueSelectors = require('postcss-unique-selectors');
var _postcssUniqueSelectors2 = _interopRequireDefault(_postcssUniqueSelectors);
var _functionOptimiser = require('./lib/functionOptimiser');
var _functionOptimiser2 = _interopRequireDefault(_functionOptimiser);
var _filterOptimiser = require('./lib/filterOptimiser');
var _filterOptimiser2 = _interopRequireDefault(_filterOptimiser);
var _normalizeString = require('./lib/normalizeString');
var _normalizeString2 = _interopRequireDefault(_normalizeString);
var _normalizeUnicode = require('./lib/normalizeUnicode');
var _normalizeUnicode2 = _interopRequireDefault(_normalizeUnicode);
var _reduceDisplayValues = require('./lib/reduceDisplayValues');
var _reduceDisplayValues2 = _interopRequireDefault(_reduceDisplayValues);
var _reduceBackgroundRepeat = require('./lib/reduceBackgroundRepeat');
var _reduceBackgroundRepeat2 = _interopRequireDefault(_reduceBackgroundRepeat);
var _reducePositions = require('./lib/reducePositions');
var _reducePositions2 = _interopRequireDefault(_reducePositions);
var _core = require('./lib/core');
var _core2 = _interopRequireDefault(_core);
var _reduceTimingFunctions = require('./lib/reduceTimingFunctions');
var _reduceTimingFunctions2 = _interopRequireDefault(_reduceTimingFunctions);
var _styleCache = require('./lib/styleCache');
var _styleCache2 = _interopRequireDefault(_styleCache);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Processors
var processors = {
postcssFilterPlugins: function postcssFilterPlugins() {
return (0, _postcssFilterPlugins3.default)({ silent: true });
},
postcssDiscardComments: _postcssDiscardComments2.default,
postcssMinifyGradients: _postcssMinifyGradients2.default,
postcssReduceInitial: _postcssReduceInitial2.default,
postcssSvgo: _postcssSvgo2.default,
reduceDisplayValues: _reduceDisplayValues2.default,
postcssReduceTransforms: _postcssReduceTransforms2.default,
autoprefixer: _autoprefixer2.default,
postcssZindex: _postcssZindex2.default,
postcssConvertValues: _postcssConvertValues2.default,
reduceTimingFunctions: _reduceTimingFunctions2.default,
postcssCalc: _postcssCalc2.default,
postcssColormin: _postcssColormin2.default,
postcssOrderedValues: _postcssOrderedValues2.default,
postcssMinifySelectors: _postcssMinifySelectors2.default,
postcssMinifyParams: _postcssMinifyParams2.default,
postcssNormalizeCharset: _postcssNormalizeCharset2.default,
postcssDiscardOverridden: _postcssDiscardOverridden2.default,
normalizeString: _normalizeString2.default,
normalizeUnicode: _normalizeUnicode2.default,
// minify-font-values should be run before discard-unused
postcssMinifyFontValues: _postcssMinifyFontValues2.default,
postcssDiscardUnused: _postcssDiscardUnused2.default,
postcssNormalizeUrl: _postcssNormalizeUrl2.default,
functionOptimiser: _functionOptimiser2.default,
filterOptimiser: _filterOptimiser2.default,
reduceBackgroundRepeat: _reduceBackgroundRepeat2.default,
reducePositions: _reducePositions2.default,
core: _core2.default,
// Optimisations after this are sensitive to previous optimisations in
// the pipe, such as whitespace normalising/selector re-ordering
postcssMergeIdents: _postcssMergeIdents2.default,
postcssReduceIdents: _postcssReduceIdents2.default,
postcssMergeLonghand: _postcssMergeLonghand2.default,
postcssDiscardDuplicates: _postcssDiscardDuplicates2.default,
postcssMergeRules: _postcssMergeRules2.default,
postcssDiscardEmpty: _postcssDiscardEmpty2.default,
postcssUniqueSelectors: _postcssUniqueSelectors2.default,
styleCache: _styleCache2.default
};
var defaultOptions = {
autoprefixer: {
add: false
},
postcssConvertValues: {
length: false
},
postcssNormalizeCharset: {
add: false
}
};
var safeOptions = {
postcssConvertValues: {
length: false
},
postcssDiscardUnused: {
disable: true
},
postcssMergeIdents: {
disable: true
},
postcssReduceIdents: {
counterStyle: false,
gridTemplate: false,
keyframes: false
},
postcssNormalizeUrl: {
stripWWW: false
},
postcssZindex: {
disable: true
}
};
var cssnano = _postcss2.default.plugin('cssnano', function () {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// Prevent PostCSS from throwing when safe is defined
if (options.safe === true) {
options.isSafe = true;
options.safe = null;
}
var safe = options.isSafe;
var proc = (0, _postcss2.default)();
var warnings = [];
if (typeof options.fontFamily !== 'undefined' || typeof options.minifyFontWeight !== 'undefined') {
warnings.push('The fontFamily & minifyFontWeight options have been ' + 'consolidated into minifyFontValues, and are now deprecated.');
if (!options.minifyFontValues) {
options.minifyFontValues = options.fontFamily;
}
}
if (typeof options.singleCharset !== 'undefined') {
warnings.push('The singleCharset option has been renamed to ' + 'normalizeCharset, and is now deprecated.');
options.normalizeCharset = options.singleCharset;
}
if (warnings.length) {
proc.use(_postcss2.default.plugin('cssnano', function () {
return function (css, result) {
return warnings.forEach(function (w) {
return result.warn(w);
});
};
}));
}
Object.keys(processors).forEach(function (plugin) {
var shortName = plugin.replace('postcss', '');
shortName = shortName.slice(0, 1).toLowerCase() + shortName.slice(1);
var opts = (0, _defined2.default)(options[shortName], options[plugin], options[(0, _decamelize2.default)(plugin, '-')]);
if (opts === false) {
opts = { disable: true };
}
opts = (0, _objectAssign2.default)({}, defaultOptions[plugin], safe ? safeOptions[plugin] : null, opts);
if (!opts.disable) {
proc.use(processors[plugin](opts));
}
});
return proc;
});
cssnano.process = function (css) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
options.map = options.map || (options.sourcemap ? true : null);
return (0, _postcss2.default)([cssnano(options)]).process(css, options);
};
exports.default = cssnano;
module.exports = exports['default'];

View File

@@ -0,0 +1,46 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var atrule = 'atrule';
var decl = 'decl';
var rule = 'rule';
function minimiseWhitespace(node) {
var type = node.type;
if (~[decl, rule, atrule].indexOf(type) && node.raws.before) {
node.raws.before = node.raws.before.replace(/\s/g, '');
}
if (type === decl) {
// Ensure that !important values do not have any excess whitespace
if (node.important) {
node.raws.important = '!important';
}
// Remove whitespaces around ie 9 hack
node.value = node.value.replace(/\s*(\\9)\s*/, '$1');
// Remove extra semicolons and whitespace before the declaration
if (node.raws.before) {
var prev = node.prev();
if (prev && prev.type !== rule) {
node.raws.before = node.raws.before.replace(/;/g, '');
}
}
node.raws.between = ':';
node.raws.semicolon = false;
} else if (type === rule || type === atrule) {
node.raws.between = node.raws.after = '';
node.raws.semicolon = false;
}
}
exports.default = (0, _postcss.plugin)('cssnano-core', function () {
return function (css) {
css.walk(minimiseWhitespace);
// Remove final newline
css.raws.after = '';
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,8 @@
"use strict";
exports.__esModule = true;
exports.default = getEvenValues;
function getEvenValues(list, index) {
return index % 2 === 0;
}
module.exports = exports["default"];

View File

@@ -0,0 +1,26 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function filterOptimiser(decl) {
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(function (node) {
if (node.type === 'function' || node.type === 'div' && node.value === ',') {
node.before = node.after = '';
}
}).toString();
}
exports.default = (0, _postcss.plugin)('cssnano-filter-optimiser', function () {
return function (css) {
return css.walkDecls(/filter/, filterOptimiser);
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,46 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function reduceCalcWhitespaces(node) {
if (node.type === 'space') {
node.value = ' ';
} else if (node.type === 'function') {
node.before = node.after = '';
}
}
function reduceWhitespaces(node) {
if (node.type === 'space') {
node.value = ' ';
} else if (node.type === 'div') {
node.before = node.after = '';
} else if (node.type === 'function') {
node.before = node.after = '';
if (node.value === 'calc') {
_postcssValueParser2.default.walk(node.nodes, reduceCalcWhitespaces);
return false;
}
}
}
function transformDecls(decl) {
if (!/filter/.test(decl.prop)) {
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(reduceWhitespaces).toString();
}
}
exports.default = (0, _postcss.plugin)('cssnano-function-optimiser', function () {
return function (css) {
return css.walkDecls(transformDecls);
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,15 @@
'use strict';
exports.__esModule = true;
exports.default = getArguments;
function getArguments(node) {
return node.nodes.reduce(function (list, child) {
if (child.type !== 'div') {
list[list.length - 1].push(child);
} else {
list.push([]);
}
return list;
}, [[]]);
}
module.exports = exports['default'];

View File

@@ -0,0 +1,14 @@
"use strict";
exports.__esModule = true;
exports.default = getMatchFactory;
function getMatchFactory(mappings) {
return function getMatch(args) {
return args.reduce(function (list, arg, i) {
return list.filter(function (keyword) {
return keyword[1][i] === arg;
});
}, mappings);
};
}
module.exports = exports["default"];

View File

@@ -0,0 +1,228 @@
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var postcss = require('postcss');
var valueParser = require('postcss-value-parser');
/*
* Constants (parser usage)
*/
var SINGLE_QUOTE = 39;
var DOUBLE_QUOTE = 34;
var BACKSLASH = 92;
var NEWLINE = 10;
var SPACE = 32;
var FEED = 12;
var TAB = 9;
var CR = 13;
var WORD_END = /[ \n\t\r\f'"\\]/g;
/*
* Constants (node type strings)
*/
var C_STRING = 'string';
var C_ESCAPED_SINGLE_QUOTE = 'escapedSingleQuote';
var C_ESCAPED_DOUBLE_QUOTE = 'escapedDoubleQuote';
var C_SINGLE_QUOTE = 'singleQuote';
var C_DOUBLE_QUOTE = 'doubleQuote';
var C_NEWLINE = 'newline';
var C_SINGLE = 'single';
/*
* Literals
*/
var L_SINGLE_QUOTE = '\'';
var L_DOUBLE_QUOTE = '"';
var L_NEWLINE = '\\\n';
/*
* Parser nodes
*/
var T_ESCAPED_SINGLE_QUOTE = { type: C_ESCAPED_SINGLE_QUOTE, value: '\\\'' };
var T_ESCAPED_DOUBLE_QUOTE = { type: C_ESCAPED_DOUBLE_QUOTE, value: '\\"' };
var T_SINGLE_QUOTE = { type: C_SINGLE_QUOTE, value: L_SINGLE_QUOTE };
var T_DOUBLE_QUOTE = { type: C_DOUBLE_QUOTE, value: L_DOUBLE_QUOTE };
var T_NEWLINE = { type: C_NEWLINE, value: L_NEWLINE };
function stringify(ast) {
return ast.nodes.reduce(function (str, _ref) {
var value = _ref.value;
// Collapse multiple line strings automatically
if (value === L_NEWLINE) {
return str;
}
return str + value;
}, '');
}
function parse(str) {
var code = void 0,
next = void 0,
value = void 0;
var pos = 0;
var len = str.length;
var ast = {
nodes: [],
types: {
escapedSingleQuote: 0,
escapedDoubleQuote: 0,
singleQuote: 0,
doubleQuote: 0
},
quotes: false
};
while (pos < len) {
code = str.charCodeAt(pos);
switch (code) {
case SPACE:
case TAB:
case CR:
case FEED:
next = pos;
do {
next += 1;
code = str.charCodeAt(next);
} while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
ast.nodes.push({
type: 'space',
value: str.slice(pos, next)
});
pos = next - 1;
break;
case SINGLE_QUOTE:
ast.nodes.push(T_SINGLE_QUOTE);
ast.types[C_SINGLE_QUOTE]++;
ast.quotes = true;
break;
case DOUBLE_QUOTE:
ast.nodes.push(T_DOUBLE_QUOTE);
ast.types[C_DOUBLE_QUOTE]++;
ast.quotes = true;
break;
case BACKSLASH:
next = pos + 1;
if (str.charCodeAt(next) === SINGLE_QUOTE) {
ast.nodes.push(T_ESCAPED_SINGLE_QUOTE);
ast.types[C_ESCAPED_SINGLE_QUOTE]++;
ast.quotes = true;
pos = next;
break;
} else if (str.charCodeAt(next) === DOUBLE_QUOTE) {
ast.nodes.push(T_ESCAPED_DOUBLE_QUOTE);
ast.types[C_ESCAPED_DOUBLE_QUOTE]++;
ast.quotes = true;
pos = next;
break;
} else if (str.charCodeAt(next) === NEWLINE) {
ast.nodes.push(T_NEWLINE);
pos = next;
break;
}
/*
* We need to fall through here to handle the token as
* a whole word. The missing 'break' is intentional.
*/
default:
WORD_END.lastIndex = pos + 1;
WORD_END.test(str);
if (WORD_END.lastIndex === 0) {
next = len - 1;
} else {
next = WORD_END.lastIndex - 2;
}
value = str.slice(pos, next + 1);
ast.nodes.push({
type: C_STRING,
value: value
});
pos = next;
}
pos++;
}
return ast;
}
function changeWrappingQuotes(node, ast) {
var types = ast.types;
if (types[C_SINGLE_QUOTE] || types[C_DOUBLE_QUOTE]) {
return;
}
if (node.quote === L_SINGLE_QUOTE && types[C_ESCAPED_SINGLE_QUOTE] > 0 && !types[C_ESCAPED_DOUBLE_QUOTE]) {
node.quote = L_DOUBLE_QUOTE;
}
if (node.quote === L_DOUBLE_QUOTE && types[C_ESCAPED_DOUBLE_QUOTE] > 0 && !types[C_ESCAPED_SINGLE_QUOTE]) {
node.quote = L_SINGLE_QUOTE;
}
ast.nodes = ast.nodes.reduce(function (newAst, child) {
if (child.type === C_ESCAPED_DOUBLE_QUOTE && node.quote === L_SINGLE_QUOTE) {
return [].concat(newAst, [T_DOUBLE_QUOTE]);
}
if (child.type === C_ESCAPED_SINGLE_QUOTE && node.quote === L_DOUBLE_QUOTE) {
return [].concat(newAst, [T_SINGLE_QUOTE]);
}
return [].concat(newAst, [child]);
}, []);
}
function normalize(value, preferredQuote) {
if (!value || !value.length) {
return value;
}
return valueParser(value).walk(function (child) {
if (child.type !== C_STRING) {
return;
}
var ast = parse(child.value);
if (ast.quotes) {
changeWrappingQuotes(child, ast);
} else if (preferredQuote === C_SINGLE) {
child.quote = L_SINGLE_QUOTE;
} else {
child.quote = L_DOUBLE_QUOTE;
}
child.value = stringify(ast);
}).toString();
}
exports.default = postcss.plugin('cssnano-normalize-string', function (opts) {
var _preferredQuote$opts = _extends({
preferredQuote: 'double'
}, opts),
preferredQuote = _preferredQuote$opts.preferredQuote;
return function (css) {
css.walk(function (node) {
if (node.type === 'rule') {
node.selector = normalize(node.selector, preferredQuote);
}
if (node.type === 'decl') {
node.value = normalize(node.value, preferredQuote);
}
if (node.type === 'atrule') {
node.params = normalize(node.params, preferredQuote);
}
});
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,67 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var _postcss2 = _interopRequireDefault(_postcss);
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function unicode(range) {
var values = range.slice(2).split('-');
if (values.length < 2) {
return range;
}
var left = values[0].split('');
var right = values[1].split('');
if (left.length !== right.length) {
return range;
}
var questionCounter = 0;
var merged = left.reduce(function (group, value, index) {
if (group === false) {
return false;
}
if (value === right[index] && !questionCounter) {
return group + value;
}
if (value === '0' && right[index] === 'f') {
questionCounter++;
return group + '?';
}
return false;
}, 'u+');
/*
* The maximum number of wildcard characters (?) for ranges is 5.
*/
if (merged && questionCounter < 6) {
return merged;
}
return range;
}
exports.default = _postcss2.default.plugin('cssnano-normalize-unicode', function () {
return function (css) {
css.walkDecls(/^unicode-range$/i, function (node) {
node.prop = 'unicode-range';
node.value = (0, _postcssValueParser2.default)(node.value).walk(function (child) {
if (child.type === 'word') {
child.value = unicode(child.value.toLowerCase());
}
return false;
}).toString();
});
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,93 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var _postcss2 = _interopRequireDefault(_postcss);
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
var _evenValues = require('./evenValues');
var _evenValues2 = _interopRequireDefault(_evenValues);
var _getArguments = require('./getArguments');
var _getArguments2 = _interopRequireDefault(_getArguments);
var _getMatch = require('./getMatch');
var _getMatch2 = _interopRequireDefault(_getMatch);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var mappings = [['repeat-x', ['repeat', 'no-repeat']], ['repeat-y', ['no-repeat', 'repeat']], ['repeat', ['repeat', 'repeat']], ['space', ['space', 'space']], ['round', ['round', 'round']], ['no-repeat', ['no-repeat', 'no-repeat']]];
var repeat = [mappings[0][0], mappings[1][0], mappings[2][0], mappings[3][0], mappings[4][0], mappings[5][0]];
var getMatch = (0, _getMatch2.default)(mappings);
function transform(decl) {
var values = (0, _postcssValueParser2.default)(decl.value);
if (values.nodes.length === 1) {
return;
}
var args = (0, _getArguments2.default)(values);
var relevant = [];
args.forEach(function (arg) {
relevant.push({
start: null,
end: null
});
arg.forEach(function (part, index) {
var isRepeat = ~repeat.indexOf(part.value);
var len = relevant.length - 1;
if (relevant[len].start === null && isRepeat) {
relevant[len].start = index;
relevant[len].end = index;
return;
}
if (relevant[len].start !== null) {
if (part.type === 'space') {
return;
} else if (isRepeat) {
relevant[len].end = index;
return;
}
return;
}
});
});
relevant.forEach(function (range, index) {
if (range.start === null) {
return;
}
var val = args[index].slice(range.start, range.end + 1);
if (val.length !== 3) {
return;
}
var match = getMatch(val.filter(_evenValues2.default).map(function (n) {
return n.value;
}));
if (match.length) {
args[index][range.start].value = match[0][0];
args[index][range.start + 1].value = '';
args[index][range.end].value = '';
}
});
decl.value = values.toString();
}
var plugin = _postcss2.default.plugin('cssnano-reduce-background-repeat', function () {
return function (css) {
return css.walkDecls(/background(-repeat|$)/, transform);
};
});
plugin.mappings = mappings;
exports.default = plugin;
module.exports = exports['default'];

View File

@@ -0,0 +1,55 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var _postcss2 = _interopRequireDefault(_postcss);
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
var _evenValues = require('./evenValues');
var _evenValues2 = _interopRequireDefault(_evenValues);
var _getMatch = require('./getMatch');
var _getMatch2 = _interopRequireDefault(_getMatch);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Specification: https://drafts.csswg.org/css-display/#the-display-properties
*/
var mappings = [['block', ['block', 'flow']], ['flow-root', ['block', 'flow-root']], ['inline', ['inline', 'flow']], ['inline-block', ['inline', 'flow-root']], ['run-in', ['run-in', 'flow']], ['list-item', ['list-item', 'block', 'flow']], ['inline-list-item', ['list-item', 'inline', 'flow']], ['flex', ['block', 'flex']], ['inline-flex', ['inline', 'flex']], ['grid', ['block', 'grid']], ['inline-grid', ['inline', 'grid']], ['ruby', ['inline', 'ruby']], ['table', ['block', 'table']], ['inline-table', ['inline', 'table']], ['table-cell', ['table-cell', 'flow']], ['table-caption', ['table-caption', 'flow']], ['ruby-base', ['ruby-base', 'flow']], ['ruby-text', ['ruby-text', 'flow']]];
var getMatch = (0, _getMatch2.default)(mappings);
function transform(node) {
var _valueParser = (0, _postcssValueParser2.default)(node.value),
nodes = _valueParser.nodes;
if (nodes.length === 1) {
return;
}
var match = getMatch(nodes.filter(_evenValues2.default).map(function (n) {
return n.value;
}));
if (match.length) {
node.value = match[0][0];
}
}
var plugin = _postcss2.default.plugin('cssnano-reduce-display-values', function () {
return function (css) {
return css.walkDecls('display', transform);
};
});
plugin.mappings = mappings;
exports.default = plugin;
module.exports = exports['default'];

View File

@@ -0,0 +1,119 @@
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _postcss = require('postcss');
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
var _has = require('has');
var _has2 = _interopRequireDefault(_has);
var _getArguments = require('./getArguments');
var _getArguments2 = _interopRequireDefault(_getArguments);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var directions = ['top', 'right', 'bottom', 'left', 'center'];
var properties = ['background', 'background-position', '-webkit-perspective-origin', 'perspective-origin'];
var center = '50%';
var horizontal = {
right: '100%',
left: '0'
};
var vertical = {
bottom: '100%',
top: '0'
};
function transform(decl) {
if (!~properties.indexOf(decl.prop)) {
return;
}
var values = (0, _postcssValueParser2.default)(decl.value);
var args = (0, _getArguments2.default)(values);
var relevant = [];
args.forEach(function (arg) {
relevant.push({
start: null,
end: null
});
arg.forEach(function (part, index) {
var isPosition = ~directions.indexOf(part.value) || (0, _postcssValueParser.unit)(part.value);
var len = relevant.length - 1;
if (relevant[len].start === null && isPosition) {
relevant[len].start = index;
relevant[len].end = index;
return;
}
if (relevant[len].start !== null) {
if (part.type === 'space') {
return;
} else if (isPosition) {
relevant[len].end = index;
return;
}
return;
}
});
});
relevant.forEach(function (range, index) {
if (range.start === null) {
return;
}
var position = args[index].slice(range.start, range.end + 1);
if (position.length > 3) {
return;
}
if (position.length === 1 || position[2].value === 'center') {
if (position[2]) {
position[2].value = position[1].value = '';
}
var value = position[0].value;
var map = _extends({}, horizontal, {
center: center
});
if ((0, _has2.default)(map, value)) {
position[0].value = map[value];
}
return;
}
if (position[0].value === 'center' && ~directions.indexOf(position[2].value)) {
position[0].value = position[1].value = '';
var _value = position[2].value;
if ((0, _has2.default)(horizontal, _value)) {
position[2].value = horizontal[_value];
}
return;
}
if ((0, _has2.default)(horizontal, position[0].value) && (0, _has2.default)(vertical, position[2].value)) {
position[0].value = horizontal[position[0].value];
position[2].value = vertical[position[2].value];
return;
} else if ((0, _has2.default)(vertical, position[0].value) && (0, _has2.default)(horizontal, position[2].value)) {
var first = position[0].value;
position[0].value = horizontal[position[2].value];
position[2].value = vertical[first];
return;
}
});
decl.value = values.toString();
}
exports.default = (0, _postcss.plugin)('cssnano-reduce-positions', function () {
return function (css) {
return css.walkDecls(transform);
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,67 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
var _postcssValueParser = require('postcss-value-parser');
var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);
var _evenValues = require('./evenValues');
var _evenValues2 = _interopRequireDefault(_evenValues);
var _getMatch = require('./getMatch');
var _getMatch2 = _interopRequireDefault(_getMatch);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var keywords = [['ease', [0.25, 0.1, 0.25, 1]], ['linear', [0, 0, 1, 1]], ['ease-in', [0.42, 0, 1, 1]], ['ease-out', [0, 0, 0.58, 1]], ['ease-in-out', [0.42, 0, 0.58, 1]]];
var getValue = function getValue(node) {
return parseFloat(node.value);
};
var getMatch = (0, _getMatch2.default)(keywords);
function reduce(node) {
if (node.type !== 'function') {
return false;
}
if (node.value === 'steps') {
// Don't bother checking the step-end case as it has the same length
// as steps(1)
if (getValue(node.nodes[0]) === 1 && node.nodes[2] && node.nodes[2].value === 'start') {
node.type = 'word';
node.value = 'step-start';
delete node.nodes;
return;
}
// The end case is actually the browser default, so it isn't required.
if (node.nodes[2] && node.nodes[2].value === 'end') {
node.nodes = [node.nodes[0]];
return;
}
return false;
}
if (node.value === 'cubic-bezier') {
var match = getMatch(node.nodes.filter(_evenValues2.default).map(getValue));
if (match.length) {
node.type = 'word';
node.value = match[0][0];
delete node.nodes;
return;
}
}
}
exports.default = (0, _postcss.plugin)('cssnano-reduce-timing-functions', function () {
return function (css) {
css.walkDecls(/(animation|transition)(-timing-function|$)/, function (decl) {
decl.value = (0, _postcssValueParser2.default)(decl.value).walk(reduce).toString();
});
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,24 @@
'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
exports.default = (0, _postcss.plugin)('cssnano-reset-stylecache', function () {
return function (css, result) {
result.root.rawCache = {
colon: ':',
indent: '',
beforeDecl: '',
beforeRule: '',
beforeOpen: '',
beforeClose: '',
beforeComment: '',
after: '',
emptyBody: '',
commentLeft: '',
commentRight: ''
};
};
});
module.exports = exports['default'];

View File

@@ -0,0 +1,145 @@
{
"_args": [
[
"cssnano@3.10.0",
"C:\\Users\\deranjer\\GoglandProjects\\torrent-project\\torrent-project"
]
],
"_from": "cssnano@3.10.0",
"_id": "cssnano@3.10.0",
"_inBundle": false,
"_integrity": "sha1-Tzj2zqK5sX+gFJDyPx3GjqZcHDg=",
"_location": "/css-loader/cssnano",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "cssnano@3.10.0",
"name": "cssnano",
"escapedName": "cssnano",
"rawSpec": "3.10.0",
"saveSpec": null,
"fetchSpec": "3.10.0"
},
"_requiredBy": [
"/css-loader"
],
"_resolved": "https://registry.npmjs.org/cssnano/-/cssnano-3.10.0.tgz",
"_spec": "3.10.0",
"_where": "C:\\Users\\deranjer\\GoglandProjects\\torrent-project\\torrent-project",
"author": {
"name": "Ben Briggs",
"email": "beneb.info@gmail.com",
"url": "http://beneb.info"
},
"ava": {
"require": "babel-core/register"
},
"bugs": {
"url": "https://github.com/ben-eb/cssnano/issues"
},
"dependencies": {
"autoprefixer": "^6.3.1",
"decamelize": "^1.1.2",
"defined": "^1.0.0",
"has": "^1.0.1",
"object-assign": "^4.0.1",
"postcss": "^5.0.14",
"postcss-calc": "^5.2.0",
"postcss-colormin": "^2.1.8",
"postcss-convert-values": "^2.3.4",
"postcss-discard-comments": "^2.0.4",
"postcss-discard-duplicates": "^2.0.1",
"postcss-discard-empty": "^2.0.1",
"postcss-discard-overridden": "^0.1.1",
"postcss-discard-unused": "^2.2.1",
"postcss-filter-plugins": "^2.0.0",
"postcss-merge-idents": "^2.1.5",
"postcss-merge-longhand": "^2.0.1",
"postcss-merge-rules": "^2.0.3",
"postcss-minify-font-values": "^1.0.2",
"postcss-minify-gradients": "^1.0.1",
"postcss-minify-params": "^1.0.4",
"postcss-minify-selectors": "^2.0.4",
"postcss-normalize-charset": "^1.1.0",
"postcss-normalize-url": "^3.0.7",
"postcss-ordered-values": "^2.1.0",
"postcss-reduce-idents": "^2.2.2",
"postcss-reduce-initial": "^1.0.0",
"postcss-reduce-transforms": "^1.0.3",
"postcss-svgo": "^2.1.1",
"postcss-unique-selectors": "^2.0.2",
"postcss-value-parser": "^3.2.3",
"postcss-zindex": "^2.0.1"
},
"description": "A modular minifier, built on top of the PostCSS ecosystem.",
"devDependencies": {
"array-to-sentence": "^1.1.0",
"ava": "^0.17.0",
"babel-cli": "^6.5.1",
"babel-core": "^6.5.1",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.0",
"babel-plugin-precompile-charcodes": "^1.0.0",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-stage-0": "^6.5.0",
"coveralls": "^2.11.6",
"cross-env": "^2.0.0",
"css-frameworks": "git+https://git@github.com/ben-eb/css-frameworks.git",
"css-minifier-tests": "git+https://git@github.com/ben-eb/css-minifier-tests.git",
"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",
"gh-pages": "^0.11.0",
"json-loader": "^0.5.4",
"ncp": "^2.0.0",
"nyc": "^10.0.0",
"postcss-font-magician": "^1.5.0",
"webpack": "^1.12.13",
"webpack-bundle-size-analyzer": "^2.0.2"
},
"eslintConfig": {
"extends": "cssnano"
},
"files": [
"dist",
"LICENSE-MIT",
"quickstart.js"
],
"homepage": "https://github.com/ben-eb/cssnano",
"keywords": [
"css",
"compress",
"minify",
"optimise",
"optimisation",
"postcss",
"postcss-plugin"
],
"license": "MIT",
"main": "dist/index.js",
"name": "cssnano",
"nyc": {
"exclude": [
"node_modules",
"**/__tests__"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/ben-eb/cssnano.git"
},
"scripts": {
"bundle-size": "webpack --json --config src/__tests__/_webpack.config.js | webpack-bundle-size-analyzer",
"docs": "cd docs && npm run build && cd .. && gh-pages -d docs/dist",
"prepublish": "del-cli dist && cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
"pretest": "eslint --ignore-path .gitignore src",
"report": "nyc report --reporter=html",
"test": "nyc ava src/__tests__/*.js",
"test-012": "nyc ava src/__tests__/*.js"
},
"tonicExampleFilename": "quickstart.js",
"version": "3.10.0"
}

View File

@@ -0,0 +1,37 @@
/*
* This example targets Node 4 and up.
*/
const cssnano = require('cssnano');
/*
* Add your CSS code here.
*/
const css = `
h1 {
color: #ff0000;
font-weight: bold;
}
`;
/*
* Add your configuration here; see http://cssnano.co/options/ and
* http://cssnano.co/optimisations/ for more details.
*
* For example you can turn off z-index rebasing by setting `zindex: false`
* in your config, or you can use `safe: true` which will turn off unsafe
* optimisations.
*/
const opts = {
};
/*
* Compress the CSS asynchronously and log it to the console.
*/
cssnano.process(css, opts).then(result => {
console.log(result.css);
});