4
0

blockString.cjs 771 B

12345678910111213141516171819202122232425
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const beforeBlockString = require('./beforeBlockString.cjs');
  5. const hasBlock = require('./hasBlock.cjs');
  6. const rawNodeString = require('./rawNodeString.cjs');
  7. /**
  8. * Return a CSS statement's block -- the string that starts and `{` and ends with `}`.
  9. *
  10. * If the statement has no block (e.g. `@import url(foo.css);`), returns an empty string.
  11. *
  12. * @param {import('postcss').Container} statement
  13. * @returns {string}
  14. */
  15. function blockString(statement) {
  16. if (!hasBlock(statement)) {
  17. return '';
  18. }
  19. return rawNodeString(statement).slice(beforeBlockString(statement).length);
  20. }
  21. module.exports = blockString;