Comments (16)
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.
@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.
@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.
@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.
@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.
@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.
@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.
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.
@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.
from webpacker.
I could do this. Do we have any way to assign tasks, to avoid duplication of efforts?
from webpacker.
I think staking your claim in this thread is good enough 👍
from webpacker.
I will do this after @gauravtiwari finishes #153 (unless he puts this in there), since the directories are configurable in his PR.
from webpacker.
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.
PR #227 is pending review.
from webpacker.
fixed by #227
from webpacker.
Related Issues (20)
- Webpacker 6 Disable Babel HOT 1
- Webpacker compilation takes more than 1.5 hours HOT 11
- How do I allow a package in node_modules to be processed by babel? HOT 1
- Remove addition of node_modules to Rails.application.config.assets.paths HOT 1
- V6 Status HOT 3
- Raise an error when javascript_pack_tag or stylesheet_pack_tag are called more than once HOT 1
- Regular Expression Denial of Service in postcss HOT 2
- Intermittent Webpacker.dev_server.running? behavior HOT 2
- Host for assets from a webpacker configuration using custom domains not being resolved HOT 2
- Cherry-pick "Nothing to do" logging update onto `5.x` HOT 1
- Rails 6 WebPacker is not calling JQuery inside views HOT 1
- Security Vulnerability in [email protected] HOT 2
- currently no loaders are configured to process this file HOT 1
- Incompatibility with Ruby 3.2.0 HOT 2
- Confusing gem description on RubyGems HOT 1
- Npm package for 5.4.4 was not released HOT 2
- class variable @@local_levels of ActiveSupport::Logger is overtaken by Logger HOT 2
- Trying to deploy but assets assets:precompile fail
- Security Vulnerability for postcss
- Postcss Security Vulnerability
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpacker.