This is my environment. Please note this is also set in the relevant development modes and production modes.
Dev:
https://ar.dev.loc/
https://en.dev.loc/
Live:
https://ar.site.com/
https://en.site.com/
I am using a multi store setup with Arabic and English and everything is working well including building modules and template building.
However, if I make a change to any less file or JS file (despite using grunt less or grunt watch) I have to run the following commands on my development environment everything single time to see them on my local machine.
$ rm -rf var/cache var/page_cache var/view_preprocessed pub/static
$ mkdir pub/static
$ bin/magento setup:static-content:deploy
$ bin/magento setup:static-content:deploy ar_SA
$ grunt exec less // sometimes I leave this do this
$ grunt // I swap between these
This takes a long time to do this process everytime. It is frustrating as I am fast coder and like to see CSS and Less immediately on the site and not wait around.
The quick approach what our team is doing is actually making changes in pub/static
and then we ship these to less and app/design
etc and then do the process above and then git.
Live server is pretty much the same. Git pull and then maintenance mode (madness on a live ecom site! Who build M2?? Then we run commands above - downtime of 45mins)
Surely there must be a quicker way for our deployment, development and team to work better and to see changes faster without downtime!
Even Magento 2 official documentation says your LIVE site needs to go into maintenance and downtime mode to publish content - this is not an option for us. The CTO are not happy. Simply absurd.
Related questions with people asking about faster development same issues:
Css changes reflect only after deploy command in magento2
Changes to CSS and JavaScript applies only after deploying static content
So I want to collate all the issues and resolve this.
yes it can be faster by following steps :
you can find the file in pub static by following command
find pub/static -iname yourjsfile.js
.htaccess in pub/static send the missing files to pub/static.php with parameter resource and pub/static.php file creates an StaticResource for the file if available and deploy that.
Note: this only works with apache mod_rewrite
For Nginx you need to configure the same via nginx.conf.sample