Closed YurySolovyov closed 7 years ago
I also created a new branch with a different approach
I like this 👍
Updated to not rely on current env, but to use Vue.minify
flag instead, every application author will need to make a separate decision if minification should depend on env and/or anything else.
The thing I noticed, is that you may not see changes after changing the state of the flag until you clear asset cache if you use it. If that's ok, I can a note to docs.
@adambutler ping
@YurySolovyov relying on current env seem reasonable default (convention over configuration, etc). Why have you decided to get rid of it?
I'm actually fine either way, but I though that this way there will be less magic, though given you can still override the flag, I can bring it back
@joxxoxo Thanks for your ideas, implemented the suggestions.
Forgive me if I've missed something but come to think about it should the Rails asset pipeline not be handling minification?
True, the thing is that it is not only about minification. Full builds enable warnings and other debug stuff, while minified versions are not just compressed version of full build, but also have debug stuff ripped off entirely. More info here
🤦♂️ Ah, of coarse that makes sense, as you were.
The only thing I'd add would be that if you're using cache for asset pipeline, you need to clear cache after switching the state of the flag.
This should be good to go.
Setting Vue.minify = true
doesn't seem to work for me, even after running rake assets:clean
.
I've uploaded my test repo: https://github.com/adambutler/vuejs-rails-test
I'm also not sure minify
should be the attribute as its behaviour extends just minification. Perhaps change this to:
Vue.development_mode = false # deafault: true
@adambutler I guess you have //= require vue
in applicaion.js
locally, right?
You may need to do rm -rf tmp/cache/assets
to ensure cache is clean.
I've pulled your repo, added require
to application.js
, added route for static#landing
and it works for both minified and not minified version
@adambutler I've checked out your repo and made changes suggested by @joxxoxo.
You're right that rake assets:clean
didn't not work, so I updated the suggested task to run and it works
Please try again.
Also renamed the flag as you pointed out.
@adambutler anything I can do to move this forward?
excited for this PR to get merged 🥇
is this getting merged anytime soon?
I like the approach. LGTM!
Thanks a lot, there are newer Vue and Vue Router out there, we might want to do a new release and also include these changes
Here is an attempt to make loading assets dynamic depending on current environment. I don't know much about asset pipeline, but I wanted to get things going. Any feedback is appreciated as well as trying out this branch.
This should fix #37