heritage-hub/postcss.config.js
Phoenix 8e886025f2 s
2024-02-01 19:57:29 +08:00

23 lines
654 B
JavaScript

import postcss from 'postcss';
import pxToViewport from 'postcss-px-to-viewport';
//自定义路径中包含navigation才需要自定义px-to-viewport
const customPxToViewportPlugin = postcss.plugin('custom-px-to-viewport', (options) => {
const pxToViewportInstance = pxToViewport({
viewportWidth: options.viewportWidth,
});
return (root, result) => {
const file = result.opts.from;
if (file && file.includes('navigation')) {
pxToViewportInstance(root, result);
}
};
});
export default {
plugins: [
customPxToViewportPlugin({
viewportWidth: 1920,
}),
],
};