Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import postcssCustomProps from 'postcss-custom-properties'
import postcssAdvancedVars from 'postcss-advanced-variables'
import postcssColor from 'postcss-color-function'
import postcssNested from 'postcss-nested'
import postcssPrefixUrl from 'postcss-prefix-url'
import postcssMedia from 'postcss-custom-media'
import postcssEach from 'postcss-each'
import colorBlend from 'color-blend'
import functions from 'postcss-functions'
import autoprefixer from 'autoprefixer'
import objectHash from 'node-object-hash'
let cssHashes = {}
let mainPlugins = []
mainPlugins.push(postcssEach)
mainPlugins.push(colorBlend())
let plugin = postcss.plugin('postcss-math', () => {
return (css) => {
// Transform CSS AST here
css.walk((node) => {
let nodeProp
if (node.type === 'decl') {
nodeProp = 'value'
} else if (node.type === 'atrule' && node.name === 'media') {
nodeProp = 'params'
} else if (node.type === 'rule') {
nodeProp = 'selector'
} else {
return
}