You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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,
}),
],
};