postcss-count-at-rules Installation: npm install postcss-count-at-rules Use: var countAtRules = require('postcss-count-at-rules'); postcss([ countAtRules(['media']); ]) See PostCSS docs for examples for your environment.