Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include 无效 #142

Open
lishichao1002 opened this issue Aug 24, 2022 · 13 comments
Open

include 无效 #142

lishichao1002 opened this issue Aug 24, 2022 · 13 comments

Comments

@lishichao1002
Copy link

include无效,看了代码,1.1.1 tag的代码和master的代码不一样,1.1.1 1.1.0代码里面都没有include字符串

@ice-fortress
Copy link

大佬太懒了,忘记发布最新版本了,npm上面的是老版本

@huangwenboha563
Copy link

大佬太懒了,忘记发布最新版本了,npm上面的是老版本

朋友你好,我想问下你这个postcss-px-to-viewport支持vite创建的的vue3项目吗?

@ice-fortress
Copy link

@huangwenboha563 支持的,我之前做项目也用过这个,你可以搜一下相关的配置,都差不多的

@markgong-gd
Copy link

等待着更新,太不方便了

@au1996
Copy link

au1996 commented Oct 27, 2022

等待着更新,太不方便了

可以先用这个xy-postcss-px-to-viewport;使用最新的master分支;支持include选项

@1014156094
Copy link

等待着更新,太不方便了

可以先用这个xy-postcss-px-to-viewport;使用最新的master分支;支持include选项

试了,根本不行

@au1996
Copy link

au1996 commented Nov 25, 2022

等待着更新,太不方便了

可以先用这个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
  }
}

@vaynevayne
Copy link

npm更新了吗?

@renxueyan
Copy link

求更新npm

@William-WFC
Copy link

https://www.npmjs.com/package/postcss-px-to-viewport-wfc 这个npm包可以用,支持 include

@UmbraCi
Copy link

UmbraCi commented Jan 3, 2024

直接用github的master分支安装
npm install https://github.com/evrone/postcss-px-to-viewport.git --save-dev

@QinZhen001
Copy link

include option invalid, Is there any other plugin instead?

@xhwgood
Copy link

xhwgood commented May 18, 2024

等待着更新,太不方便了

可以先用这个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}`),
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests