Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (ast.type === 'StyleSheet') {
input = ast.children;
ast.children = output;
} else {
input = wrapBlock(ast);
}
do {
chunk = readChunk(input, Boolean(specialComments));
compressChunk(chunk.stylesheet, firstAtrulesAllowed, chunkNum++, compressOptions);
chunkChildren = chunk.stylesheet.children;
if (chunk.comment) {
// add \n before comment if there is another content in output
if (!output.isEmpty()) {
output.insert(List.createItem({
type: 'Raw',
value: '\n'
}));
}
output.insert(List.createItem(chunk.comment));
// add \n after comment if chunk is not empty
if (!chunkChildren.isEmpty()) {
output.insert(List.createItem({
type: 'Raw',
value: '\n'
}));
}
}
do {
chunk = readChunk(input, Boolean(specialComments));
compressChunk(chunk.stylesheet, firstAtrulesAllowed, chunkNum++, compressOptions);
chunkChildren = chunk.stylesheet.children;
if (chunk.comment) {
// add \n before comment if there is another content in output
if (!output.isEmpty()) {
output.insert(List.createItem({
type: 'Raw',
value: '\n'
}));
}
output.insert(List.createItem(chunk.comment));
// add \n after comment if chunk is not empty
if (!chunkChildren.isEmpty()) {
output.insert(List.createItem({
type: 'Raw',
value: '\n'
}));
}
}
if (firstAtrulesAllowed && !chunkChildren.isEmpty()) {
var lastRule = chunkChildren.last();
if (lastRule.type !== 'Atrule' ||
(lastRule.name !== 'import' && lastRule.name !== 'charset')) {
firstAtrulesAllowed = false;
enter: (node, item, list) => {
let value
let nodeText
const scopedClassName = List.createItem({
name: hashedClassName,
type: 'ClassSelector',
})
const whiteSpace = List.createItem({
type: 'WhiteSpace',
value: ' ',
})
// these need to be synced with the
// HTML structure in Layout.jsx
if (
list &&
node.type === 'TypeSelector' &&
node.name === 'html'
) {
node.name = hashedClassName // eslint-disable-line no-param-reassign
enter: (node, item, list) => {
let value
let nodeText
const scopedClassName = List.createItem({
name: hashedClassName,
type: 'ClassSelector',
})
const whiteSpace = List.createItem({
type: 'WhiteSpace',
value: ' ',
})
// these need to be synced with the
// HTML structure in Layout.jsx
if (
list &&
node.type === 'TypeSelector' &&
node.name === 'html'
) {
node.name = hashedClassName // eslint-disable-line no-param-reassign
node.type = 'ClassSelector' // eslint-disable-line no-param-reassign
}
if (