heritage-hub/postcss.config.js

23 lines
654 B
JavaScript
Raw Permalink Normal View History

2024-02-01 11:49:57 +00:00
import postcss from 'postcss';
2024-02-01 10:54:28 +00:00
import pxToViewport from 'postcss-px-to-viewport';
2024-02-01 11:57:29 +00:00
//自定义路径中包含navigation才需要自定义px-to-viewport
2024-02-01 11:49:57 +00:00
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);
}
};
});
2024-02-01 10:54:28 +00:00
export default {
plugins: [
2024-02-01 11:49:57 +00:00
customPxToViewportPlugin({
2024-02-01 10:54:28 +00:00
viewportWidth: 1920,
}),
2024-02-01 11:49:57 +00:00
],
2024-02-01 10:54:28 +00:00
};