Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function format(css, { minify = false } = {}) {

node.children.forEach((selector, item) => {
if (selector.type === TYPE_SELECTOR) {
buffer += print_selector(selector)
buffer += indent(indent_level) + print_simple_selector(selector)
}

if (item.next !== null) {
Expand Down Expand Up @@ -220,14 +220,6 @@ export function format(css, { minify = false } = {}) {
return buffer
}

/**
* @param {import('css-tree').Selector} node
* @returns {string} A formatted Selector
*/
function print_selector(node) {
return indent(indent_level) + print_simple_selector(node)
}

/**
* @param {import('css-tree').Block} node
* @returns {string} A formatted Block
Expand Down Expand Up @@ -294,7 +286,7 @@ export function format(css, { minify = false } = {}) {
let block = node.block
buffer += lowercase(node.name)

// @font-face has no prelude
// @font-face and anonymous @layer have no prelude
if (prelude !== null) {
buffer += SPACE + print_prelude(prelude)
}
Expand Down Expand Up @@ -366,9 +358,9 @@ export function format(css, { minify = false } = {}) {
if (node.type === 'Identifier') {
buffer += node.name
} else if (node.type === 'Function') {
buffer += print_function(node)
buffer += lowercase(node.name) + OPEN_PARENTHESES + print_list(node.children) + CLOSE_PARENTHESES
} else if (node.type === 'Dimension') {
buffer += print_dimension(node)
buffer += node.value + lowercase(node.unit)
} else if (node.type === 'Value') {
// Values can be inside var() as fallback
// var(--prop, VALUE)
Expand Down Expand Up @@ -433,11 +425,6 @@ export function format(css, { minify = false } = {}) {
return buffer
}

/** @param {import('css-tree').Dimension} node */
function print_dimension(node) {
return node.value + lowercase(node.unit)
}

/**
* @param {import('css-tree').Value | import('css-tree').Raw} node
*/
Expand All @@ -449,13 +436,6 @@ export function format(css, { minify = false } = {}) {
return print_list(node.children)
}

/**
* @param {import('css-tree').FunctionNode} node
*/
function print_function(node) {
return lowercase(node.name) + OPEN_PARENTHESES + print_list(node.children) + CLOSE_PARENTHESES
}

/**
* @param {import('css-tree').CssNode} node
* @param {number} indent_level
Expand Down