  In this paper, we derive an energy conservation criterion based on a
combination of velocity and its gradient for the weak solutions of both the
homogeneous incompressible Navier-Stokes equations and the general compressible
Navier-Stokes equations. For the incompressible case, this class implies most
known corresponding results on periodic domain via either the velocity or its
gradient including the famous Lions' energy conservation criterion obtained in
\cite{[Lions]}. For the compressible case, this helps us to extend the
previously known criteria for the energy conservation of weak solutions from
the incompressible fluid to compressible flow and improve the recent results
due to Nguyen-Nguyen-Tang in \cite[Nonlinearity 32 (2019)]{[NNT]} and Liang in
\cite[Proc. Roy. Soc. Edinburgh Sect. A (2020)]{[Liang]}.
