文件操作 - normalize-viewbox.js
返回文件管理
返回主菜单
删除本文件
文件: /var/www/OLD/node_modules/svg-baker/lib/transformations/normalize-viewbox.js
编辑文件内容
const merge = require('merge-options'); const { getRoot } = require('../utils'); const defaultConfig = { removeDimensions: false }; /** * @param {Object} [config] {@see defaultConfig} * @return {Function} PostHTML plugin */ function normalizeViewBox(config = {}) { const cfg = merge(defaultConfig, config); return (tree) => { const root = getRoot(tree); root.attrs = root.attrs || {}; const attrs = root.attrs; const { width, height, viewBox } = attrs; if (!viewBox && width && height) { attrs.viewBox = `0 0 ${parseFloat(width).toString()} ${parseFloat(height).toString()}`; if (cfg.removeDimensions) { delete attrs.width; delete attrs.height; } } return tree; }; } module.exports = normalizeViewBox;
修改文件时间
将文件时间修改为当前时间的前一年
删除文件