Answer the question
In order to leave comments, you need to log in
Should files be stored in git after minification, concatenation and other obfuscation via grunt?
Example. There is a project with repositories: locally, git and on the server.
During development, grunt is used which, when changing files, runs concat, uglify, cssmin and htmlmin. The modified files end up in the dest folder so as not to replace the original files that are being worked on.
Since the production server also uses git, which will pull the changes, but due to the fact that the compressed files are in the dest folder (and should replace the original ones), the changes will not get to the site.
Question - how to set up git and grunt so that minified files immediately get to the server without additional dances with a tambourine?
Answer the question
In order to leave comments, you need to log in
why not load scripts and styles from the dest folder?
well, or already set up phing or competitors.
well, or AssetBundle from symfony to use.
No, you don't need to store build results in a repository. Then the head will hurt from the questions “are the collected files now synchronized with the source codes or not?”.
There are several options. One of them is to run the build on the server. Those. the server does `git pull && grunt build` and new files appear. Better yet, do not git pull, but git clone to a new folder. Then you can quickly roll back to the previous version if something went wrong. Name folders according to the current time. And store the last N (well, for example, five).
project
2016-02-29-12-15-36
2016-03-15-17-00-11
2016-03-21-11-57-59
current -> 2016-03-21-11-57-59 // current — ссылка на папку с последней версией
git clone <%projecturl%> <%currenttime%>
cd <%currenttime%>
grunt build
cd ..
rm <%current%>
ln -s <%currenttime%> current
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question