mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* remove early return so that all plugins are handled We had an early return so that once a plugin was matched, that we could stop running the code through the other plugins. However, in this case we have an issue that user defined css is technically also a plugin. This means that: - `bg-green-light` Would check for: - `bg-green-light` (no hit, continue) - `bg-green` (Hit! Don't execute next plugins) - `bg` (This is the one that would have generated `bg-green-light`) We tested this change and it doesn't seem to have an impact functionally and also not really performance wise. * update changelog
60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
import fs from 'fs'
|
|
import path from 'path'
|
|
|
|
import { html, run, css } from './util/run'
|
|
|
|
test('basic usage', () => {
|
|
let config = {
|
|
content: [path.resolve(__dirname, './basic-usage.test.html')],
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
let input = css`
|
|
@tailwind base;
|
|
@tailwind components;
|
|
@tailwind utilities;
|
|
`
|
|
|
|
return run(input, config).then((result) => {
|
|
let expectedPath = path.resolve(__dirname, './basic-usage.test.css')
|
|
let expected = fs.readFileSync(expectedPath, 'utf8')
|
|
|
|
expect(result.css).toMatchFormattedCss(expected)
|
|
})
|
|
})
|
|
|
|
test('all plugins are executed that match a candidate', () => {
|
|
let config = {
|
|
content: [{ raw: html`<div class="bg-green-light bg-green"></div>` }],
|
|
theme: {
|
|
colors: {
|
|
green: {
|
|
light: 'green',
|
|
},
|
|
},
|
|
},
|
|
corePlugins: { preflight: false },
|
|
}
|
|
|
|
let input = css`
|
|
@tailwind utilities;
|
|
|
|
.bg-green {
|
|
/* Empty on purpose */
|
|
}
|
|
`
|
|
|
|
return run(input, config).then((result) => {
|
|
expect(result.css).toMatchFormattedCss(css`
|
|
.bg-green-light {
|
|
--tw-bg-opacity: 1;
|
|
background-color: rgb(0 128 0 / var(--tw-bg-opacity));
|
|
}
|
|
|
|
.bg-green {
|
|
/* Empty on purpose */
|
|
}
|
|
`)
|
|
})
|
|
})
|