trim.ts 305 B

1234567891011
  1. import { Root } from 'postcss'
  2. import * as postcss from 'postcss'
  3. export default postcss.plugin('trim', () => (css: Root) => {
  4. css.walk(({ type, raws }) => {
  5. if (type === 'rule' || type === 'atrule') {
  6. if (raws.before) raws.before = '\n'
  7. if (raws.after) raws.after = '\n'
  8. }
  9. })
  10. })