Add ninja template for copying to the gen folder

We are doing this so often and the syntax for the `outputs` arg
is difficult to remember, I figured it is better to extract out
a template. This should make it easier to copy-paste from other
BUILD.gn files as well.

[email protected],[email protected]

Bug: 1088463
Change-Id: Ic78ee5082ee5eae4e07f7ceeb21842f54dcbaf56
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2224807
Commit-Queue: Tim van der Lippe <[email protected]>
Reviewed-by: Jack Franklin <[email protected]>
Reviewed-by: Paul Lewis <[email protected]>
diff --git a/front_end/third_party/lit-html/BUILD.gn b/front_end/third_party/lit-html/BUILD.gn
index 007b289..33e4ec5 100644
--- a/front_end/third_party/lit-html/BUILD.gn
+++ b/front_end/third_party/lit-html/BUILD.gn
@@ -2,7 +2,9 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-copy("lit-html") {
+import("../../../scripts/build/copy_to_gen.gni")
+
+copy_to_gen("lit-html") {
   sources = [
     "lit-html-tsconfig.json",
     "package/directives/class-map.d.ts",
@@ -42,6 +44,4 @@
     "package/lit-html.js",
     "package/lit-html.js.map",
   ]
-
-  outputs = [ "{{source_gen_dir}}/{{source_file_part}}" ]
 }