Code Monkey home page Code Monkey logo

Comments (8)

SassNinja avatar SassNinja commented on July 25, 2024 1

I'm afraid that's not possible with the postcss-plugin-only approach because in this case the build tool decides when each file is processed and I cannot say "process only the final output".
The only thing you could do here is starting two build processes where the 2nd one would process the file, emitted by the 1st one. However doesn't seem to be a good solution.

Therefore I think you should definitely go with the webpack plugin because this has much more power since it's more than just a postcss plugin. I'm not sure how well this works with CSS modules though.

I'd suggest you open a new issue in media-query-plugin repository and provide a reproducible example build process (e.g. using https://codesandbox.io/) and then describe what you would expect so that I can take a look at what can be done.

from postcss-extract-media-query.

SassNinja avatar SassNinja commented on July 25, 2024

@alpipego thanks for using this plugin and your question.

I'm not sure if I understood you correctly.
Would you provide more details regarding your project setup?
Is the component specific CSS defined in separate files?

If so I'd suggest to work over your build process to limit this PostCSS plugin to your main file only.

from postcss-extract-media-query.

alpipego avatar alpipego commented on July 25, 2024

Thanks for your reply. This was a typical case of looking at the trees without seeing the woods. Instead of globbing all files in a dir, I now have a separate (grunt) PostCSS task that only runs on the main file (as you suggested).

Thanks for making this plugin. It's exactly what I was looking for 💯🔥

from postcss-extract-media-query.

ajayjaggi97 avatar ajayjaggi97 commented on July 25, 2024

Hey, i wanna do something similar.
@alpipego @SassNinja could you explain more here pls.

from postcss-extract-media-query.

SassNinja avatar SassNinja commented on July 25, 2024

Hi @ajayjaggi97

what do you mean with "similar"?

In this issue it was about not processing all files which in the end was achieved by adjusting the build process. So it depends on what build tool you're using or rather how your setup looks.

from postcss-extract-media-query.

ajayjaggi97 avatar ajayjaggi97 commented on July 25, 2024

I am using webpack and postcss-loader
I want to extract the media queries from the final output file(build file) rather than the individual files.

from postcss-extract-media-query.

SassNinja avatar SassNinja commented on July 25, 2024
  1. are you aware there's a specialised webpack plugin?
    https://github.com/SassNinja/media-query-plugin

  2. why do you wanna extract from the final output instead of the individual files? The result should be the same.

from postcss-extract-media-query.

ajayjaggi97 avatar ajayjaggi97 commented on July 25, 2024

Yes i checked the webpack plugin as well.
But the in extracted files, classnames are not getting dangled.(css modules)
So i thought extracting from the final output file might resolve the issue.

from postcss-extract-media-query.

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.