heritage-hub/postcss.config.js

25 lines
731 B
JavaScript
Raw 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:49:57 +00:00
import { customPostCSSPlugin } from "./src/utils/custom-postcss-plugin.js"; // 替换为实际的路径
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
customPostCSSPlugin({
}),
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
};