Giter Club home page Giter Club logo

Comments (6)

tiagovtristao avatar tiagovtristao commented on May 30, 2024

I'm facing the same issue, I wonder if this is a limitation with esbuild at the moment. Is this something that you know @glromeo ? Nice plugin by the way :-)

from esbuild-sass-plugin.

glromeo avatar glromeo commented on May 30, 2024

Sorry guys what you ask is against esbuild design. In order for the css modules to be imported they have to be specified as 'js' for the loader and then esbuild leaves their handling to the plugin with no way for that css to be part of the compact bundle you want. I left this issue open while I was getting my head around the possibility of writing myself a bundling of all the styles module into a single one but the effort of such task (considering the issue with sourcemaps) puts it out of scope

from esbuild-sass-plugin.

ronkorland avatar ronkorland commented on May 30, 2024

@glromeo I created custom transform for this but I don't find a way to know when the rebuild started so I can remove/clean the css file

from esbuild-sass-plugin.

glromeo avatar glromeo commented on May 30, 2024

@ronkorland esbuild provides a callback for that https://esbuild.github.io/plugins/#on-end

you just have to add an extra little plugin to your build e.g.

   ...
   plugins: [
     esbuildSassPlugin({...}),
      {
        name: 'example',
        setup(build) {
          build.onEnd(result => {
            ...here you can trigger your remove/clean...
          })
        },
      }
   ]
   ...

from esbuild-sass-plugin.

yourivdlans avatar yourivdlans commented on May 30, 2024

I would also be interested in extracting the css to a separate file. @ronkorland would you mind sharing your approach?

from esbuild-sass-plugin.

glromeo avatar glromeo commented on May 30, 2024

@franckchen @yourivdlans @tiagovtristao @ronkorland
v2.7.0 brings, at long last, a solution to this CSS vs Js problem
while playing nicely with esbuild pipeline...have a try!

from esbuild-sass-plugin.

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.