evrone / postcss-px-to-viewport

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.
https://evrone.com/postcss-px-viewport
MIT License
2.98k stars 401 forks source link

include 无效 #142

Open lishichao1002 opened 1 year ago

lishichao1002 commented 1 year ago

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

ice-fortress commented 1 year ago

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

huangwenboha563 commented 1 year ago

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

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

ice-fortress commented 1 year ago

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

markgong-gd commented 1 year ago

等待着更新,太不方便了

au1996 commented 1 year ago

等待着更新,太不方便了

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

1014156094 commented 1 year ago

等待着更新,太不方便了

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

试了,根本不行

au1996 commented 1 year ago

等待着更新,太不方便了

可以先用这个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 commented 1 year ago

npm更新了吗?

renxueyan commented 1 year ago

求更新npm

William-WFC commented 8 months ago

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

UmbraCi commented 6 months ago

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

QinZhen001 commented 5 months ago

include option invalid, Is there any other plugin instead?

xhwgood commented 1 month ago

等待着更新,太不方便了

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