Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Unified Diff: third_party/polymer/extract_inline_scripts.sh

Issue 592593002: Inline scripts were extracted from Polymer elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/extract_inline_scripts.sh
diff --git a/third_party/polymer/extract_inline_scripts.sh b/third_party/polymer/extract_inline_scripts.sh
new file mode 100755
index 0000000000000000000000000000000000000000..2a213eaabd6e61427ff5d6754bbc856e4d0c0b8b
--- /dev/null
+++ b/third_party/polymer/extract_inline_scripts.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+set -e
+
+if [ "$#" -ne 0 ]
+then
+ echo "Usage: $0"
+ echo ""
+ echo "Extracts inline scripts from Polymer HTML files to external JS files."
+ echo "Prints the names of created JS files to the standard output."
+ exit 1
+fi
+
+if [ -e "components-extracted" ]
+then
+ echo "ERROR: 'components-extracted' already exists. Please remove it before" \
+ "running the script." 1>&2
+ exit 1
+fi
+
+cp -r components components-extracted
+find components-extracted -name "*.html" \
+ -not -path "*/demos/*" \
+ -not -name "demo*.html" \
+ -not -name "index.html" \
+ -not -name "metadata.html" | \
+xargs grep -l "<script>" | \
+while read original_html
raymes 2014/09/23 00:27:56 original_html->original_html_filename
dzhioev (left Google) 2014/09/23 09:48:53 Done.
+do
+ dir=$(dirname "$original_html")
+ name=$(basename "$original_html" .html)
+
+ html_without_js="$dir/$name-extracted.html"
+ extracted_js="$dir/$name-extracted.js"
+ vulcanize -o "$html_without_js" --csp --config vulcanize_config.json \
+ "$original_html" 1>&2
+ mv "$html_without_js" "$original_html"
+ echo "$extracted_js"
+done

Powered by Google App Engine
This is Rietveld 408576698