We present a novel and general formulation for the optimisation of gradient coils, wherein the minimization of the conductor length and the simplicity of construction are two of the main design parameters. The bi-planar gradient coils are intended to be part of a new compact neonatal magnetic resonance imaging (MRI) scanner based on a 0.35 T permanent magnet. It is shown that minimizing the current density vector is equivalent to minimizing the wire length. The gradient coil design involves a convex optimization method where the Euclidian and Manhattan norms of the current density vector are minimized under the field linearity, wire width, force and shielding constraints. The design problem is solved iteratively in order to include the influence of the magnetization of the pole and iron ring over the gradient field linearity. A suite of gradient coils using both norms and resistance minimization are designed and their performances are compared. Gradient coils designed using Euclidian norm show shorter wire length and slightly better performance than that designed using Manhattan norms; however, the presence of straight wires in the current pattern is very convenient for manufacturing purpose.