Giter Site home page Giter Site logo

Comments (4)

NikolayMakhonin avatar NikolayMakhonin commented on June 2, 2024

Yes, it is a design choise, see this regexp

/"[^"]+"|'[^']+'|url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)px/g

it ignored all the var statements, I think it's because of the variable names, which can include something like --1px. We just need to improve regexp and there will be no such problem:

/"[^"]+"|'[^']+'|url\([^)]+\)|((?<=^|[^\w-])-?\d*\.?\d+)px\b/g

from postcss-pxtorem.

AAAAAAAAAdai avatar AAAAAAAAAdai commented on June 2, 2024

是的,这是一种设计选择,请参看此正则表达式

/"[^"]+"|'[^']+'|url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)px/g

它忽略了所有的var语言句子,我认为这是因为变量名,它可以包含类似的--1px。我们只需要改变进入正则表达式就不会出现这样的问题:

/"[^"]+"|'[^']+'|url\([^)]+\)|((?<=^|[^\w-])-?\d*\.?\d+)px\b/g

left: -10px; not working

from postcss-pxtorem.

citrus327 avatar citrus327 commented on June 2, 2024

any progress?

from postcss-pxtorem.

dimitry-blinov avatar dimitry-blinov commented on June 2, 2024

@yangmingshan @cuth Please add the ability to convert px to em inside var in the callback ignoring custom variables. Can u merge and release a new version?

from postcss-pxtorem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.