Coder Social home page Coder Social logo

Comments (2)

undeadcat avatar undeadcat commented on May 26, 2024

Thanks for the issue!
Sorry for abandoning this project for a bit.
A simpler reproduction would be:

const Title = styled(Title)`

  position: relative;
  overflow: hidden;

  @supports (-webkit-line-clamp: 4) {
      -webkit-line-clamp: 1; //parse errors here
      text-overflow: ellipsis;
  }

The cause is: the plugin currently assumes syntax within styled-components string to be LESS but styled-components allows more syntax. We should definitely bring this in line with what's acceptable at runtime.

As a workaround, if I understand correctly, one could surround the properties inside @supports with a rule-set with a '&' selector, it would be processed to the equivalent CSS :

const Title = styled(Title)`
  position: relative;
  overflow: hidden;

  @supports (-webkit-line-clamp: 4) {
    & {
      -webkit-line-clamp: 1;
      text-overflow: ellipsis;
    }
  }
`

from webstorm-styled-components.

undeadcat avatar undeadcat commented on May 26, 2024

I'd like bring the plugin closer to parsing the same set of syntex that styled-components actually accepts. @mxstbr, can you help figure out what other syntax styled-components supports that's not present in CSS/Less?

Semicolons seem to be optional, as one example.

It seems to me like styled-components uses stylis.js to parse styles internally, but then there is also the PostCSS parser used in one place.

If stylis is what's used, should I assume the stylis tests are a good reference of what's supported and what's not?

from webstorm-styled-components.

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.