mirror of
https://github.com/wu736139669/Monkey-Test.git
synced 2026-08-05 05:55:46 +00:00
22 lines
636 B
JavaScript
22 lines
636 B
JavaScript
'use strict';
|
|
|
|
var postcss = require('postcss');
|
|
|
|
module.exports = postcss.plugin('postcss-zindex', function () {
|
|
return function (css) {
|
|
var cache = require('./lib/layerCache')();
|
|
var nodes = [];
|
|
// First pass; cache all z indexes
|
|
css.eachDecl('z-index', function (decl) {
|
|
nodes.push(decl);
|
|
cache.addValue(decl.value);
|
|
});
|
|
// Second pass; optimise
|
|
nodes.forEach(function (decl) {
|
|
// Need to coerce to string so that the
|
|
// AST is updated correctly
|
|
decl.value = '' + cache.convert(decl.value);
|
|
})
|
|
};
|
|
});
|