GithubHelp home page GithubHelp logo

Comments (5)

geelen avatar geelen commented on May 5, 2024 3

Yeah I get where you're head's at, but I'm reluctant to move in that direction at this moment. The way we use tagged template literals and interpolations makes it difficult to integrate any pure-CSS tool like PostCSS. Which is why we've had to break compatibility already (just minor stuff so far) to get it running where we want.

The other thing is that the two use-cases you mention (object fit polyfill & responsive text) seem far better suited to a component-driven solution (e.g. react-object-fit-cover). Styled Components presupposes both a component system & a runtime JS environment which I feel like can cover most of the things people have needed PostCSS transforms for in the past.

But depending on what #59 ends up with, it might be possible. I'm going to close this in favour of that one, but I'll keep the idea in the back of my head as I work on it.

from styled-components.

giuseppeg avatar giuseppeg commented on May 5, 2024

csjs has it – maybe you can fork theirs.

But since this library is using postcss internally already there might be a better way, for example here is how we do this in suitcss-preprocessor

from styled-components.

mxstbr avatar mxstbr commented on May 5, 2024

Which plugins would you like to see? We're looking towards linting mostly, which others are interesting to you?

from styled-components.

geelen avatar geelen commented on May 5, 2024

We're using a modified version of PostCSS internally but we may change that up in future. We're not trying to build a flexible CSS processor we're just providing a minimum of functionality (i.e. nesting). If there are particular transforms people want to use then let us know.

The good news is that a lot of the use cases for postcss transforms can be replaced with pure-JS approaches. I've just updated the docs with an example: https://github.com/styled-components/styled-components/blob/master/docs/tips-and-tricks.md

from styled-components.

SeeThruHead avatar SeeThruHead commented on May 5, 2024

The idea is not that we need a specific list of transforms for use with this library, more so that leveraging the previous work and extensive ecosystem of postcss would a great benefit to this project.

A recent, concrete example was that we were wanting to use the object-fit polyfill for certain browsers. There is already a postcss transform designed exactly for our use case. Other things might be responsive text, like we've got in rucksack. It's not really about exactly which ones I want to use, but opening up the tool to leverage an ecosystem that already exists.

One of the things I like about the babel-transform option is that it remove the need for styled-components to have any kind of preprocessing included. You could just set a few sane default postcss plugins and allow the option for addition/overwriting of postcss plugins. csjs has the right idea here in my opinion. They've made a csjs specific babel plugin for postcss transformations at build time. (That is another good reason to use a babel transform, the pure js solutions to postcss (jss has many of these types of things) tend to be designed to run at runtime on the string literal or object. A babel plugin would reduce runtime cost as well as runtime dependency weight.

I can carve out some time to look into this if it's something the styled-components team would consider integrating.

Thanks.

from 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.