Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blockString.js « utils « lib « stylelint « node_modules « assets - github.com/fourtyone11/origin-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fd0b385f6e61f9e82f35261cea74d52222d239fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';

const beforeBlockString = require('./beforeBlockString');
const hasBlock = require('./hasBlock');
const rawNodeString = require('./rawNodeString');

/** @typedef {import('postcss').Rule} Rule */
/** @typedef {import('postcss').AtRule} AtRule */

/**
 * Return a CSS statement's block -- the string that starts and `{` and ends with `}`.
 *
 * If the statement has no block (e.g. `@import url(foo.css);`),
 * return false.
 *
 * @param {Rule | AtRule} statement - postcss rule or at-rule node
 * @return {string | boolean}
 */
module.exports = function(statement) {
	if (!hasBlock(statement)) {
		return false;
	}

	return rawNodeString(statement).slice(beforeBlockString(statement).length);
};