-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-assets.sh
executable file
·51 lines (38 loc) · 1.17 KB
/
copy-assets.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
assetsPath=assets/js
echo "🔔 Copying required Font file assets from node_modules..."
fontAssets=(
"node_modules/@fortawesome/fontawesome-free/webfonts/."
)
for asset in ${fontAssets[@]}
do
echo ✅ $asset
cp -r $asset assets/fonts
done
echo "🔔 Copying required CSS assets from node_modules..."
cssAssets=(
"node_modules/prismjs/themes/prism-okaidia.css"
"node_modules/prismjs/plugins/toolbar/prism-toolbar.css"
)
for asset in ${cssAssets[@]}
do
echo ✅ $asset
cp $asset assets/css
done
echo "🔔 Copying required JS assets from node_modules..."
jsAssets=(
"node_modules/jquery/dist/jquery.min.js"
"node_modules/bootstrap/dist/js/bootstrap.min.js"
"node_modules/prismjs/prism.js"
"node_modules/prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"
"node_modules/prismjs/plugins/toolbar/prism-toolbar.min.js"
)
for asset in ${jsAssets[@]}
do
echo ✅ $asset
cp $asset $assetsPath
done
echo "🔔 Minifying JS assets..."
find $assetsPath -type f -name "*.js" ! -name "*.min.js" -exec echo {} \; -exec npx uglifyjs -m -o {}.min {} \;
find $assetsPath -type f -name "*.js.min" -exec rename -f 's/\.js\.min$/.min.js/' {} \;
echo "✅ Done"