新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
31 lines
808 B
JavaScript
31 lines
808 B
JavaScript
var { isNodeChildrenList } = require('./utils');
|
|
|
|
function isSafeOperator(node) {
|
|
return node.type === 'Operator' && node.value !== '+' && node.value !== '-';
|
|
}
|
|
|
|
module.exports = function cleanWhitespace(node, item, list) {
|
|
// remove when first or last item in sequence
|
|
if (item.next === null || item.prev === null) {
|
|
list.remove(item);
|
|
return;
|
|
}
|
|
|
|
// white space in stylesheet or block children
|
|
if (isNodeChildrenList(this.stylesheet, list) ||
|
|
isNodeChildrenList(this.block, list)) {
|
|
list.remove(item);
|
|
return;
|
|
}
|
|
|
|
if (item.next.data.type === 'WhiteSpace') {
|
|
list.remove(item);
|
|
return;
|
|
}
|
|
|
|
if (isSafeOperator(item.prev.data) || isSafeOperator(item.next.data)) {
|
|
list.remove(item);
|
|
return;
|
|
}
|
|
};
|