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

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: Restore bower.json files. 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" \
michaelpg 2016/04/02 02:15:53 also nice
25 --prune-empty-dirs "$src/" "$dst/"
25 26
26 find "$dst" -name "*.html" \ 27 find "$dst" -name "*.html" | \
27 -not -path "*/demos/*" \
28 -not -path "*/test/*" \
29 -not -path "*/tests/*" \
30 -not -name "demo*.html" \
31 -not -name "index.html" \
32 -not -name "metadata.html" | \
33 xargs grep -l "<script>" | \ 28 xargs grep -l "<script>" | \
34 while read original_html_name 29 while read original_html_name
35 do 30 do
36 dir=$(dirname "$original_html_name") 31 dir=$(dirname "$original_html_name")
37 name=$(basename "$original_html_name" .html) 32 name=$(basename "$original_html_name" .html)
38 33
39 html_without_js="$dir/$name-extracted.html" 34 html_without_js="$dir/$name-extracted.html"
40 extracted_js="$dir/$name-extracted.js" 35 extracted_js="$dir/$name-extracted.js"
41 echo "Crisping $original_html_name" 36 echo "Crisping $original_html_name"
42 crisper --script-in-head=false --source "$original_html_name" \ 37 crisper --script-in-head=false --source "$original_html_name" \
43 --html "$html_without_js" --js "$extracted_js" 38 --html "$html_without_js" --js "$extracted_js"
44 mv "$html_without_js" "$original_html_name" 39 mv "$html_without_js" "$original_html_name"
45 done 40 done
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698