mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-25 06:56:56 +02:00
refactor(cssnano-preset): migrate to TS (#7440)
* refactor(cssnano-preset): migrate to TS * fix
This commit is contained in:
parent
c8b5f230ab
commit
71b5901bcd
9 changed files with 76 additions and 43 deletions
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const vfile = require('to-vfile');
|
||||
const postcss = require('postcss');
|
||||
const postCssRemoveOverriddenCustomProperties = require('../index');
|
||||
|
||||
const processFixture = (name) => {
|
||||
const input = vfile.readSync(
|
||||
path.join(__dirname, '__fixtures__', `${name}.css`),
|
||||
'utf8',
|
||||
);
|
||||
const output = postcss([postCssRemoveOverriddenCustomProperties]).process(
|
||||
input,
|
||||
);
|
||||
|
||||
return output.css;
|
||||
};
|
||||
|
||||
describe('remove-overridden-custom-properties', () => {
|
||||
it('overridden custom properties should be removed', () => {
|
||||
expect(processFixture('normal')).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('overridden custom properties with `!important` rule should not be removed', () => {
|
||||
expect(processFixture('important_rule')).toMatchSnapshot();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue