plugin1
font-size: 10px;font-size: 20px;
plugin2
font-size: 20px;
font-size: 10px;
Created
September 3, 2016 10:39
-
-
Save TrySound/a8d8f8566f870bd432ebbc24af45c0a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const postcss = require('postcss'); | |
const plugin1 = postcss.plugin('test', () => { | |
return css => { | |
css.walkDecls(decl => { | |
if (decl.value === '10px') { | |
decl.cloneAfter({ | |
value: '20px' | |
}); | |
} | |
}); | |
}; | |
}); | |
const plugin2 = postcss.plugin('test', () => { | |
return css => { | |
css.walkDecls(decl => { | |
if (decl.value === '10px') { | |
decl.cloneBefore({ | |
value: '20px' | |
}); | |
} | |
}); | |
}; | |
}); | |
console.log('plugin1'); | |
console.log(postcss([plugin1]).process('font-size: 10px;').css); | |
console.log('plugin2'); | |
console.log(postcss([plugin2]).process('font-size: 10px;').css); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment