1 | ;
|
2 |
|
3 | const beforeBlockString = require('./beforeBlockString');
|
4 | const hasBlock = require('./hasBlock');
|
5 | const rawNodeString = require('./rawNodeString');
|
6 |
|
7 | /** @typedef {import('postcss').Rule} Rule */
|
8 | /** @typedef {import('postcss').AtRule} AtRule */
|
9 |
|
10 | /**
|
11 | * Return a CSS statement's block -- the string that starts and `{` and ends with `}`.
|
12 | *
|
13 | * If the statement has no block (e.g. `@import url(foo.css);`),
|
14 | * return false.
|
15 | *
|
16 | * @param {Rule | AtRule} statement - postcss rule or at-rule node
|
17 | * @return {string | boolean}
|
18 | */
|
19 | module.exports = function (statement) {
|
20 | if (!hasBlock(statement)) {
|
21 | return false;
|
22 | }
|
23 |
|
24 | return rawNodeString(statement).slice(beforeBlockString(statement).length);
|
25 | };
|