Emit defaults from apply in css modules (#6875)

* Emit defaults from apply in css modules

* Update changelog
This commit is contained in:
Jordan Pittman 2022-01-04 11:29:33 -05:00 • committed by GitHub
parent 41e32bd9a7
commit 058a9256ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 9 deletions

View file

@ -1,5 +1,6 @@
import fs from 'fs'
import path from 'path'
import { DEFAULTS_LAYER } from '../src/lib/expandTailwindAtRules.js'
import { run, html, css } from './util/run'
@ -810,3 +811,39 @@ it('should be possible to apply user css without tailwind directives', () => {
`)
})
})
fit('apply can emit defaults in isolated environments without @tailwind directives', () => {
let config = {
[DEFAULTS_LAYER]: true,
experimental: { optimizeUniversalDefaults: true },
content: [{ raw: html`<div class="foo"></div>` }],
}
let input = css`
.foo {
@apply focus:rotate-90;
}
`
return run(input, config).then((result) => {
return expect(result.css).toMatchFormattedCss(css`
.foo {
--tw-translate-x: 0;
--tw-translate-y: 0;
--tw-rotate: 0;
--tw-skew-x: 0;
--tw-skew-y: 0;
--tw-scale-x: 1;
--tw-scale-y: 1;
--tw-transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y))
rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y))
scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.foo:focus {
--tw-rotate: 90deg;
transform: var(--tw-transform);
}
`)
})
})