import-processing.test.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { html, css, run } from './util/run'
  2. describe('import processing', () => {
  3. it('should be possible to import another css file', async () => {
  4. let config = {
  5. darkMode: 'class',
  6. content: [
  7. {
  8. raw: html`<div class="underline" />`,
  9. },
  10. ],
  11. corePlugins: { preflight: false },
  12. }
  13. let input = css`
  14. @import './import-processing-a.css';
  15. `
  16. let result = await run(input, config)
  17. expect(result.css).toMatchFormattedCss(css`
  18. .underline {
  19. text-decoration-line: underline;
  20. }
  21. `)
  22. })
  23. it('should be possible to import another css file after @tailwind directive', async () => {
  24. let config = {
  25. darkMode: 'class',
  26. content: [
  27. {
  28. raw: html`<div class="foo underline" />`,
  29. },
  30. ],
  31. corePlugins: { preflight: false },
  32. }
  33. let input = css`
  34. @tailwind utilities;
  35. @import './import-processing-b.css';
  36. `
  37. let result = await run(input, config)
  38. expect(result.css).toMatchFormattedCss(css`
  39. .underline {
  40. text-decoration-line: underline;
  41. }
  42. .foo {
  43. color: red;
  44. }
  45. `)
  46. })
  47. it('should be possible to add @config before @import statements', async () => {
  48. let input = css`
  49. @config "./import-processing-c.js";
  50. @import './import-processing-c.css';
  51. `
  52. let result = await run(input)
  53. expect(result.css).toMatchFormattedCss(css`
  54. .underline {
  55. text-decoration-line: underline;
  56. }
  57. .foo {
  58. color: red;
  59. }
  60. `)
  61. })
  62. })