run.js 752 B

12345678910111213141516171819202122232425262728293031323334
  1. import path from 'path'
  2. import postcss from 'postcss'
  3. import tailwind from '../../src'
  4. export * from './strings'
  5. export * from './defaults'
  6. export let map = JSON.stringify({
  7. version: 3,
  8. file: null,
  9. sources: [],
  10. names: [],
  11. mappings: '',
  12. })
  13. export function run(input, config, plugin = tailwind) {
  14. let { currentTestName } = expect.getState()
  15. return postcss(plugin(config)).process(input, {
  16. from: `${path.resolve(__filename)}?test=${currentTestName}`,
  17. })
  18. }
  19. export function runWithSourceMaps(input, config, plugin = tailwind) {
  20. let { currentTestName } = expect.getState()
  21. return postcss(plugin(config)).process(input, {
  22. from: `${path.resolve(__filename)}?test=${currentTestName}`,
  23. map: {
  24. prev: map,
  25. },
  26. })
  27. }