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.
22 lines
626 B
22 lines
626 B
|
2 years ago
|
"use strict";
|
||
|
|
|
||
|
|
Object.defineProperty(exports, "__esModule", {
|
||
|
|
value: true
|
||
|
|
});
|
||
|
|
exports["default"] = _default;
|
||
|
|
/**
|
||
|
|
* Executes a provided function once for each CSS block element.
|
||
|
|
*
|
||
|
|
* @param {Root|Document} root - root element of file.
|
||
|
|
* @param {function} cb - Function to execute for each CSS block element
|
||
|
|
*/
|
||
|
|
function _default(root, cb) {
|
||
|
|
// class `Document` is a part of `postcss-html`,
|
||
|
|
// It is collection of roots in HTML File.
|
||
|
|
// See: https://github.com/gucong3000/postcss-html/blob/master/lib/document.js
|
||
|
|
if (root.constructor.name === "Document") {
|
||
|
|
root.nodes.forEach(cb);
|
||
|
|
} else {
|
||
|
|
cb(root);
|
||
|
|
}
|
||
|
|
}
|