refactor(cssnano-preset): migrate to TS (#7440)

* refactor(cssnano-preset): migrate to TS

* fix
This commit is contained in:
Joshua Chen 2022-05-17 21:41:30 +08:00 committed by GitHub
parent c8b5f230ab
commit 71b5901bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 76 additions and 43 deletions

View file

@ -0,0 +1,27 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import advancedBasePreset from 'cssnano-preset-advanced';
import postCssSortMediaQueries from 'postcss-sort-media-queries';
import postCssRemoveOverriddenCustomProperties from './remove-overridden-custom-properties';
const preset: typeof advancedBasePreset = function preset(opts) {
const advancedPreset = advancedBasePreset({
autoprefixer: {add: false},
discardComments: {removeAll: true},
...opts,
});
advancedPreset.plugins.unshift(
[postCssSortMediaQueries, undefined],
[postCssRemoveOverriddenCustomProperties, undefined],
);
return advancedPreset;
};
export = preset;