[gnome-bootstrap-theme] feat: compile with bootstrap version number



commit b8ebbf01afaa37cef6856f2026988af9cee2825d
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Sun Sep 25 20:06:54 2022 +0200

    feat: compile with bootstrap version number

 .gitignore           |  1 +
 build_deneb_theme.sh | 23 +++++++++++++++++------
 index.html           |  4 ++--
 3 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a6c1d0b..81e24a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 /dist
+/dist*
 /node_modules
 package-lock.json
 .sass-cache
diff --git a/build_deneb_theme.sh b/build_deneb_theme.sh
index 12b8a9a..01d4d1c 100755
--- a/build_deneb_theme.sh
+++ b/build_deneb_theme.sh
@@ -1,13 +1,24 @@
 #!/usr/bin/env bash
 
+BOOTSTRAP_VERSION="$(grep bootstrap package.json | sed 
"s/\"bootstrap\":\s\"\^\([[:digit:]]\.[[:digit:]]\).*\"/\1/" | tr -d " ")"
+declare -r BOOTSTRAP_VERSION
+
+OUTPUT_DIRECTORY="./dist.bootstrap-${BOOTSTRAP_VERSION}"
+declare -r OUTPUT_DIRECTORY
+mkdir -p "${OUTPUT_DIRECTORY}"
+
 # CSS
-sass -t expanded src/css/main.scss > ./dist/deneb.css
-sass -t compressed src/css/main.scss > ./dist/deneb.min.css
+sass -t expanded src/css/main.scss >"${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.css"
+sass -t compressed src/css/main.scss >"${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.min.css"
 
 # JS
-cat ./node_modules/bootstrap/dist/js/bootstrap.bundle.js src/js/navbar-search-form.js > ./dist/deneb.js
-cp ./node_modules/bootstrap/dist/js/bootstrap.bundle.js.map ./dist/bootstrap.bundle.js.map
-uglifyjs ./dist/deneb.js -c -m -o ./dist/deneb.min.js
+cat ./node_modules/bootstrap/dist/js/bootstrap.bundle.js src/js/navbar-search-form.js 
"${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.js"
+cp ./node_modules/bootstrap/dist/js/bootstrap.bundle.js.map 
"${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.js.map"
+sed -i "s/bootstrap.bundle.js.map/deneb.${BOOTSTRAP_VERSION}.js.map/g" 
"${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.js"
+uglifyjs "${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.js" -c -m -o 
"${OUTPUT_DIRECTORY}/deneb.${BOOTSTRAP_VERSION}.min.js"
 
 # FontAwesome Webfonts
-cp -r ./node_modules/@fortawesome/fontawesome-free/webfonts ./dist/webfonts
\ No newline at end of file
+cp -r ./node_modules/@fortawesome/fontawesome-free/webfonts "${OUTPUT_DIRECTORY}/webfonts"
+
+# Finalise
+cp -r "${OUTPUT_DIRECTORY}" "./dist"
\ No newline at end of file
diff --git a/index.html b/index.html
index 1185e4c..cb97006 100644
--- a/index.html
+++ b/index.html
@@ -8,7 +8,7 @@
   <meta name="application-name" content="GNOME.org Website">
   <link rel="icon" type="image/png" href="src/images/favicon.ico"/>
   <title>GNOME Deneb</title>
-  <link href="dist/deneb.css" rel="stylesheet">
+  <link href="dist/deneb.5.2.min.css" rel="stylesheet">
   <style>
       section {
           padding: 40px 0;
@@ -195,7 +195,7 @@
   </div>
 </div>
 
-<script src="dist/deneb.js"></script>
+<script src="dist/deneb.5.2.min.js"></script>
 
 </body>
 </html>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]