postcss-px-to-viewport
postcss-px-to-viewport copied to clipboard
include 无效
include无效,看了代码,1.1.1 tag的代码和master的代码不一样,1.1.1 1.1.0代码里面都没有include字符串
大佬太懒了,忘记发布最新版本了,npm上面的是老版本
大佬太懒了,忘记发布最新版本了,npm上面的是老版本
朋友你好,我想问下你这个postcss-px-to-viewport支持vite创建的的vue3项目吗?
@huangwenboha563 支持的,我之前做项目也用过这个,你可以搜一下相关的配置,都差不多的
等待着更新,太不方便了
等待着更新,太不方便了
可以先用这个xy-postcss-px-to-viewport;使用最新的
master
分支;支持include
选项试了,根本不行
在windows目录中path分隔为反斜杠,在传入include/exclude参数需注意;举个栗子:
// postcss.config.js
// os: windows
const plugins = {
autoprefixer: {},
'xy-postcss-px-to-viewport': {
exclude: [/\\node_modules\\/i],
include: [/\\src\\views\\home\\/i]
}
}
module.exports = () => {
if (process.env.NODE_ENV === 'development') {
delete plugins.autoprefixer
} else {
// 这里走 CICD 中 Linux 系统;如果你是本地 Windows 打包;注释掉下面两行
plugins['xy-postcss-px-to-viewport'].exclude = [/\/node_modules\//i]
plugins['xy-postcss-px-to-viewport'].include = [/\/src\/views\/home\//i]
}
return {
plugins
}
}
npm更新了吗?
求更新npm
https://www.npmjs.com/package/postcss-px-to-viewport-wfc 这个npm包可以用,支持 include
直接用github的master分支安装 npm install https://github.com/evrone/postcss-px-to-viewport.git --save-dev
include option invalid, Is there any other plugin instead?
等待着更新,太不方便了
可以先用这个xy-postcss-px-to-viewport;使用最新的
master
分支;支持include
选项试了,根本不行
亲测该依赖可用,推荐这样写正则,分隔符引入依赖变量
import path from 'path';
const regSep = `\\${path.sep}`;
const includeFiles = [
new RegExp(`${regSep}src${regSep}pages${regSep}StaticIndex${regSep}`),
new RegExp(`${regSep}src${regSep}staticComponents${regSep}`),
new RegExp(`${regSep}src${regSep}layouts${regSep}EnterLayout${regSep}`),
];