You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
305 B

4 years ago
  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. })