Coder Social home page Coder Social logo

Comments (4)

ryelle avatar ryelle commented on July 17, 2024

It looks like we already have https://github.com/postcss/postcss-custom-properties here, so this should be working, but I think it doesn't play well with the MiniCSSExtractPlugin step, since only the file that defines the :root is getting the fallbacks.

The easiest solution would be to pull all CSS back into one file, and only import that one file in JS, but I don't want to loose the component-level CSS 😕 Another option is to set up our own postcss config (wp-scripts will use a local postcss.config.js file) & re-define postcss-custom-properties so that we can pass the custom properties in. I think this is the way to go here.

from pattern-directory.

iandunn avatar iandunn commented on July 17, 2024

I don't want to loose the component-level CSS

💯

I think it doesn't play well with the MiniCSSExtractPlugin step

Is that because of a bug, or just an incompatibility? If it's a bug, then another option would be to just file a report upstream. Unless this breaks functionality, I don't think we need to go out of our way for IE11 support.

from pattern-directory.

ryelle avatar ryelle commented on July 17, 2024

I didn't spend enough time in their repo to see if it's intentional, but I think it's just how webpack/postcss works. The custom properties plugin reads the variables from the CSS, but AFAICT postcss runs before the CSS is concat'd, so file-one.css doesn't know the custom properties defined in file-two.css. postcss-custom-properties has a config option to pass in a set of property definitions so it doesn't need to read from the CSS, that's the fix I'm suggesting.

from pattern-directory.

iandunn avatar iandunn commented on July 17, 2024

Huh, it seems odd that it'd require a custom config, I imagine lots of other projects would want to do the same thing. Oh well, maybe wp-scripts just hasn't added support for that yet 🤷🏻‍♂️

In that case the custom config wfm.

from pattern-directory.

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.