Skip to content

Commit 2c081e5

Browse files
committed
fix(css): disable postcss merge-longhand due to css vars bug
1 parent c34cbde commit 2c081e5

2 files changed

Lines changed: 32 additions & 17 deletions

File tree

scripts/helpers/cssnano-preset-default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const postcssMinifyParams = require('postcss-minify-params');
2727
// const postcssNormalizeCharset = require('postcss-normalize-charset');
2828
const postcssMinifyFontValues = require('postcss-minify-font-values');
2929
const postcssNormalizeUrl = require('postcss-normalize-url');
30-
const postcssMergeLonghand = require('postcss-merge-longhand');
30+
// const postcssMergeLonghand = require('postcss-merge-longhand');
3131
const postcssDiscardDuplicates = require('postcss-discard-duplicates');
3232
// const postcssDiscardOverridden = require('postcss-discard-overridden');
3333
const postcssNormalizeRepeatStyle = require('postcss-normalize-repeat-style');
@@ -80,7 +80,7 @@ module.exports = function defaultPreset (opts = {}) {
8080
[postcssNormalizeRepeatStyle, options.normalizeRepeatStyle],
8181
[postcssNormalizePositions, options.normalizePositions],
8282
[postcssNormalizeWhitespace, options.normalizeWhitespace],
83-
[postcssMergeLonghand, options.mergeLonghand],
83+
// [postcssMergeLonghand, options.mergeLonghand],
8484
[postcssDiscardDuplicates, options.discardDuplicates],
8585
[postcssMergeRules, options.mergeRules],
8686
[postcssDiscardEmpty, options.discardEmpty],

src/compiler/style/test/optimize-css.spec.ts

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,36 @@ describe('optimizeCss', () => {
243243
expect(output).toBe(`h1{width:calc(10px - (100px / var(--test)))}`);
244244
});
245245

246-
it('merge-longhand', async () => {
247-
config.minifyCss = true;
248-
const styleText = `
249-
h1 {
250-
margin-top: 10px;
251-
margin-right: 20px;
252-
margin-bottom: 10px;
253-
margin-left: 20px;
254-
}
255-
`;
256-
const output = await optimizeCss(config, compilerCtx, diagnostics, styleText, null, true);
257-
258-
expect(diagnostics).toHaveLength(0);
259-
expect(output).toBe(`h1{margin:10px 20px}`);
260-
});
246+
// it('merge-longhand', async () => {
247+
// config.minifyCss = true;
248+
// const styleText = `
249+
// h1 {
250+
// margin-top: 10px;
251+
// margin-right: 20px;
252+
// margin-bottom: 10px;
253+
// margin-left: 20px;
254+
// }
255+
// `;
256+
// const output = await optimizeCss(config, compilerCtx, diagnostics, styleText, null, true);
257+
258+
// expect(diagnostics).toHaveLength(0);
259+
// expect(output).toBe(`h1{margin:10px 20px}`);
260+
// });
261+
262+
// it('merge-longhand w/ css vars', async () => {
263+
// config.minifyCss = true;
264+
// const styleText = `
265+
// a {
266+
// border-width: var(--border-width);
267+
// border-style: var(--border-style);
268+
// border-color: var(--btn-border-color);
269+
// }
270+
// `;
271+
// const output = await optimizeCss(config, compilerCtx, diagnostics, styleText, null, true);
272+
273+
// expect(diagnostics).toHaveLength(0);
274+
// expect(output).toBe(`a{border:none}`);
275+
// });
261276

262277
it('discard-duplicates', async () => {
263278
config.minifyCss = true;

0 commit comments

Comments
 (0)