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

Side by Side Diff: third_party/polymer/v1_0/extract_inline_scripts.sh

Issue 1834313003: Remove unneeded files from third_party/polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update create_components_summary.py Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 set -e 7 set -e
8 8
9 if [ "$#" -ne 2 ] 9 if [ "$#" -ne 2 ]
10 then 10 then
11 echo "Usage: $0 <src_dir> <dst_dir>" 11 echo "Usage: $0 <src_dir> <dst_dir>"
12 echo 12 echo
13 echo "Extracts inlined scripts from <src_dir> to <dst_dir>" \ 13 echo "Extracts inlined scripts from <src_dir> to <dst_dir>" \
14 "Polymer HTML files found in the destination directory to separate JS" \ 14 "Polymer HTML files found in the destination directory to separate JS" \
15 "files. A JS file extracted from the file with name 'foo.html' will" \ 15 "files. A JS file extracted from the file with name 'foo.html' will" \
16 "have a name 'foo-extracted.js'. Inclusion of the script file will be" \ 16 "have a name 'foo-extracted.js'. Inclusion of the script file will be" \
17 "added to 'foo.html': '<script src=\"foo-extracted.js\"></script>'." 17 "added to 'foo.html': '<script src=\"foo-extracted.js\"></script>'."
18 exit 1 18 exit 1
19 fi 19 fi
20 20
21 src="${1%/}" 21 src="${1%/}"
22 dst="${2%/}" 22 dst="${2%/}"
23 23
24 rsync -c --delete -r -v --exclude="compiled_resources*.gyp" "$src/" "$dst/" 24 rsync -c --delete -r -v --exclude-from="rsync_exclude.txt" "$src/" "$dst/"
25 25
26 find "$dst" -name "*.html" \ 26 find "$dst" -name "*.html" \
27 -not -path "*/demos/*" \ 27 -not -path "*/demos/*" \
28 -not -path "*/test/*" \ 28 -not -path "*/test/*" \
29 -not -path "*/tests/*" \ 29 -not -path "*/tests/*" \
30 -not -name "demo*.html" \ 30 -not -name "demo*.html" \
31 -not -name "index.html" \ 31 -not -name "index.html" \
32 -not -name "metadata.html" | \ 32 -not -name "metadata.html" | \
Dan Beam 2016/03/29 23:30:07 maybe all the -nots should be in the rsync_exclude
dpapad 2016/03/30 00:29:55 Done.
33 xargs grep -l "<script>" | \ 33 xargs grep -l "<script>" | \
34 while read original_html_name 34 while read original_html_name
35 do 35 do
36 dir=$(dirname "$original_html_name") 36 dir=$(dirname "$original_html_name")
37 name=$(basename "$original_html_name" .html) 37 name=$(basename "$original_html_name" .html)
38 38
39 html_without_js="$dir/$name-extracted.html" 39 html_without_js="$dir/$name-extracted.html"
40 extracted_js="$dir/$name-extracted.js" 40 extracted_js="$dir/$name-extracted.js"
41 echo "Crisping $original_html_name" 41 echo "Crisping $original_html_name"
42 crisper --script-in-head=false --source "$original_html_name" \ 42 crisper --script-in-head=false --source "$original_html_name" \
43 --html "$html_without_js" --js "$extracted_js" 43 --html "$html_without_js" --js "$extracted_js"
44 mv "$html_without_js" "$original_html_name" 44 mv "$html_without_js" "$original_html_name"
45 done 45 done
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698