GithubHelp home page GithubHelp logo

Comments (16)

sealocal avatar sealocal commented on May 6, 2024 2

I think a parallel clobber task makes sense. But, rails assets:precompile doesn't clobber assets so if rails webpacker:compile clobbers assets, then it would seem inconsistent and perhaps confusing to the user.

from webpacker.

justin808 avatar justin808 commented on May 6, 2024 1

@aganov Thanks for the ping. I'm going to check this out today. If I can't get to this by this evening HST, I'll hand this off to you if you like. Great pointers on the clobber and clean!

from webpacker.

justin808 avatar justin808 commented on May 6, 2024 1

@aganov If you want to submit a PR for clean, that might be useful. Given the way the manifest.json works with webpacker, I'm not sure we want to keep old assets around per the sprockets algorithm.

from webpacker.

gauravtiwari avatar gauravtiwari commented on May 6, 2024

@justin808 Yes, sounds good. Perhaps, this task is also run before assets are compiled by default so, we cleanup old files. I recall in react on rails you had a rm -rf app/assets/webpack in Procfile.

from webpacker.

justin808 avatar justin808 commented on May 6, 2024

@sealocal @gauravtiwari @rafaelfranca Does anybody know why assets:precompile does not clobber the /public/assets directory?

@gauravtiwari I agree that the webpacker:compile task should always clear out old assets. I cannot think of any reason why somebody would want to keep old assets around. For example, when switching from development to production testing, if you don't clobber, you'll get files both with and without hashes.

from webpacker.

dleavitt avatar dleavitt commented on May 6, 2024

@justin808 a couple of thoughts on why assets:precompile might not wipe things. Let's think about a production deployment:

  • The clobber step always has to happen first. So if the compile fails you're going to be left with no assets.
  • Even if the compile doesn't fail, let's say you're caching some of your pages. Until the cache expires, your page may serve broken assets.

Both of these scenarios probably won't be a problem if you're set up correctly, but I'd guess reasons like this are why clobber isn't part of precompile by default (you can always add it to your build process yourself if needed.)

from webpacker.

justin808 avatar justin808 commented on May 6, 2024

@dleavitt the second point is quite valid!

Even if the compile doesn't fail, let's say you're caching some of your pages. Until the cache expires, your page may serve broken assets.

So yes, I'd agree that we should keep it separate.

Also, should we have one clobber task that runs both?

from webpacker.

dleavitt avatar dleavitt commented on May 6, 2024

maybe assets:clobber should run both, per the way assets:precompile works:
https://github.com/rails/webpacker/blob/master/lib/tasks/webpacker.rake#L148-L151

from webpacker.

gauravtiwari avatar gauravtiwari commented on May 6, 2024

@dleavitt Yeah, that makes sense. On heroku or other container based deployments, this might not be a issue as each deploy is self-contained and doesn't affect the current version if fails, however having said that isn't for all cases so, perhaps we can do something like - assets:clean for packs, which I think is similar to what's been said earlier.

from webpacker.

dhh avatar dhh commented on May 6, 2024

from webpacker.

justin808 avatar justin808 commented on May 6, 2024

I could do this. Do we have any way to assign tasks, to avoid duplication of efforts?

from webpacker.

dhh avatar dhh commented on May 6, 2024

I think staking your claim in this thread is good enough 👍

from webpacker.

justin808 avatar justin808 commented on May 6, 2024

I will do this after @gauravtiwari finishes #153 (unless he puts this in there), since the directories are configurable in his PR.

from webpacker.

aganov avatar aganov commented on May 6, 2024

Hi @justin808 Do you have any plans to start this? I was thinking about something like sprockets's manifest.clobber and manifest.clean methods implemented in the Webpacker::Manifest class #clobber and #clean ...

from webpacker.

justin808 avatar justin808 commented on May 6, 2024

PR #227 is pending review.

from webpacker.

gauravtiwari avatar gauravtiwari commented on May 6, 2024

fixed by #227

from webpacker.

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.