Fix `grunt dist` under Bower by separating docs into separate task

Fixes #13949.
Also does some refactoring.
CC: @twbs/team 

:punch:
:bird: :gun:
:fist: