You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
6.9 KiB

4 years ago
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = defaultPreset;
  6. var _cssDeclarationSorter = require('css-declaration-sorter');
  7. var _cssDeclarationSorter2 = _interopRequireDefault(_cssDeclarationSorter);
  8. var _postcssDiscardComments = require('postcss-discard-comments');
  9. var _postcssDiscardComments2 = _interopRequireDefault(_postcssDiscardComments);
  10. var _postcssReduceInitial = require('postcss-reduce-initial');
  11. var _postcssReduceInitial2 = _interopRequireDefault(_postcssReduceInitial);
  12. var _postcssMinifyGradients = require('postcss-minify-gradients');
  13. var _postcssMinifyGradients2 = _interopRequireDefault(_postcssMinifyGradients);
  14. var _postcssSvgo = require('postcss-svgo');
  15. var _postcssSvgo2 = _interopRequireDefault(_postcssSvgo);
  16. var _postcssReduceTransforms = require('postcss-reduce-transforms');
  17. var _postcssReduceTransforms2 = _interopRequireDefault(_postcssReduceTransforms);
  18. var _postcssConvertValues = require('postcss-convert-values');
  19. var _postcssConvertValues2 = _interopRequireDefault(_postcssConvertValues);
  20. var _postcssCalc = require('postcss-calc');
  21. var _postcssCalc2 = _interopRequireDefault(_postcssCalc);
  22. var _postcssColormin = require('postcss-colormin');
  23. var _postcssColormin2 = _interopRequireDefault(_postcssColormin);
  24. var _postcssOrderedValues = require('postcss-ordered-values');
  25. var _postcssOrderedValues2 = _interopRequireDefault(_postcssOrderedValues);
  26. var _postcssMinifySelectors = require('postcss-minify-selectors');
  27. var _postcssMinifySelectors2 = _interopRequireDefault(_postcssMinifySelectors);
  28. var _postcssMinifyParams = require('postcss-minify-params');
  29. var _postcssMinifyParams2 = _interopRequireDefault(_postcssMinifyParams);
  30. var _postcssNormalizeCharset = require('postcss-normalize-charset');
  31. var _postcssNormalizeCharset2 = _interopRequireDefault(_postcssNormalizeCharset);
  32. var _postcssMinifyFontValues = require('postcss-minify-font-values');
  33. var _postcssMinifyFontValues2 = _interopRequireDefault(_postcssMinifyFontValues);
  34. var _postcssNormalizeUrl = require('postcss-normalize-url');
  35. var _postcssNormalizeUrl2 = _interopRequireDefault(_postcssNormalizeUrl);
  36. var _postcssMergeLonghand = require('postcss-merge-longhand');
  37. var _postcssMergeLonghand2 = _interopRequireDefault(_postcssMergeLonghand);
  38. var _postcssDiscardDuplicates = require('postcss-discard-duplicates');
  39. var _postcssDiscardDuplicates2 = _interopRequireDefault(_postcssDiscardDuplicates);
  40. var _postcssDiscardOverridden = require('postcss-discard-overridden');
  41. var _postcssDiscardOverridden2 = _interopRequireDefault(_postcssDiscardOverridden);
  42. var _postcssNormalizeRepeatStyle = require('postcss-normalize-repeat-style');
  43. var _postcssNormalizeRepeatStyle2 = _interopRequireDefault(_postcssNormalizeRepeatStyle);
  44. var _postcssMergeRules = require('postcss-merge-rules');
  45. var _postcssMergeRules2 = _interopRequireDefault(_postcssMergeRules);
  46. var _postcssDiscardEmpty = require('postcss-discard-empty');
  47. var _postcssDiscardEmpty2 = _interopRequireDefault(_postcssDiscardEmpty);
  48. var _postcssUniqueSelectors = require('postcss-unique-selectors');
  49. var _postcssUniqueSelectors2 = _interopRequireDefault(_postcssUniqueSelectors);
  50. var _postcssNormalizeString = require('postcss-normalize-string');
  51. var _postcssNormalizeString2 = _interopRequireDefault(_postcssNormalizeString);
  52. var _postcssNormalizePositions = require('postcss-normalize-positions');
  53. var _postcssNormalizePositions2 = _interopRequireDefault(_postcssNormalizePositions);
  54. var _postcssNormalizeWhitespace = require('postcss-normalize-whitespace');
  55. var _postcssNormalizeWhitespace2 = _interopRequireDefault(_postcssNormalizeWhitespace);
  56. var _postcssNormalizeUnicode = require('postcss-normalize-unicode');
  57. var _postcssNormalizeUnicode2 = _interopRequireDefault(_postcssNormalizeUnicode);
  58. var _postcssNormalizeDisplayValues = require('postcss-normalize-display-values');
  59. var _postcssNormalizeDisplayValues2 = _interopRequireDefault(_postcssNormalizeDisplayValues);
  60. var _postcssNormalizeTimingFunctions = require('postcss-normalize-timing-functions');
  61. var _postcssNormalizeTimingFunctions2 = _interopRequireDefault(_postcssNormalizeTimingFunctions);
  62. var _cssnanoUtilRawCache = require('cssnano-util-raw-cache');
  63. var _cssnanoUtilRawCache2 = _interopRequireDefault(_cssnanoUtilRawCache);
  64. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  65. const defaultOpts = {
  66. convertValues: {
  67. length: false
  68. },
  69. normalizeCharset: {
  70. add: false
  71. },
  72. cssDeclarationSorter: {
  73. exclude: true
  74. }
  75. }; /**
  76. * @author Ben Briggs
  77. * @license MIT
  78. * @module cssnano:preset:default
  79. * @overview
  80. *
  81. * This default preset for cssnano only includes transforms that make no
  82. * assumptions about your CSS other than what is passed in. In previous
  83. * iterations of cssnano, assumptions were made about your CSS which caused
  84. * output to look different in certain use cases, but not others. These
  85. * transforms have been moved from the defaults to other presets, to make
  86. * this preset require only minimal configuration.
  87. */
  88. function defaultPreset(opts = {}) {
  89. const options = Object.assign({}, defaultOpts, opts);
  90. const plugins = [[_postcssDiscardComments2.default, options.discardComments], [_postcssMinifyGradients2.default, options.minifyGradients], [_postcssReduceInitial2.default, options.reduceInitial], [_postcssSvgo2.default, options.svgo], [_postcssNormalizeDisplayValues2.default, options.normalizeDisplayValues], [_postcssReduceTransforms2.default, options.reduceTransforms], [_postcssColormin2.default, options.colormin], [_postcssNormalizeTimingFunctions2.default, options.normalizeTimingFunctions], [_postcssCalc2.default, options.calc], [_postcssConvertValues2.default, options.convertValues], [_postcssOrderedValues2.default, options.orderedValues], [_postcssMinifySelectors2.default, options.minifySelectors], [_postcssMinifyParams2.default, options.minifyParams], [_postcssNormalizeCharset2.default, options.normalizeCharset], [_postcssDiscardOverridden2.default, options.discardOverridden], [_postcssNormalizeString2.default, options.normalizeString], [_postcssNormalizeUnicode2.default, options.normalizeUnicode], [_postcssMinifyFontValues2.default, options.minifyFontValues], [_postcssNormalizeUrl2.default, options.normalizeUrl], [_postcssNormalizeRepeatStyle2.default, options.normalizeRepeatStyle], [_postcssNormalizePositions2.default, options.normalizePositions], [_postcssNormalizeWhitespace2.default, options.normalizeWhitespace], [_postcssMergeLonghand2.default, options.mergeLonghand], [_postcssDiscardDuplicates2.default, options.discardDuplicates], [_postcssMergeRules2.default, options.mergeRules], [_postcssDiscardEmpty2.default, options.discardEmpty], [_postcssUniqueSelectors2.default, options.uniqueSelectors], [_cssDeclarationSorter2.default, options.cssDeclarationSorter], [_cssnanoUtilRawCache2.default, options.rawCache]];
  91. return { plugins };
  92. }
  93. module.exports = exports['default'];