CSS -> SASS
authorGreg Burri <greg.burri@gmail.com>
Thu, 10 Sep 2020 17:32:31 +0000 (19:32 +0200)
committerGreg Burri <greg.burri@gmail.com>
Thu, 10 Sep 2020 17:32:31 +0000 (19:32 +0200)
.gitignore
backend/build.rs [new file with mode: 0644]
backend/conf.ron [new file with mode: 0644]
backend/static/style.css [deleted file]
backend/style.scss [new file with mode: 0644]
conf.ron [deleted file]

index c41e4eb..e97304b 100644 (file)
@@ -2,3 +2,5 @@
 **/*.rs.bk
 key.secret
 WebSharper/key
+backend/static/style.css
+style.css.map
\ No newline at end of file
diff --git a/backend/build.rs b/backend/build.rs
new file mode 100644 (file)
index 0000000..ba5da7e
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+Additionnal build, doc: https://doc.rust-lang.org/cargo/reference/build-scripts.html
+
+What is build here:
+ - Compile the SASS file to CSS file.
+*/
+
+use std::process::Command;
+
+fn main() {
+    println!("cargo:rerun-if-changed=style.scss");
+
+    let output =
+        Command::new("sass")
+            .arg("./style.scss")
+            .arg("./static/style.css")
+            .output()
+            .expect("Unable to compile SASS file, install SASS, see https://sass-lang.com/");
+
+    if !output.status.success() {
+        //panic!("Unable to compile SASS file, install SASS, see https://sass-lang.com/")
+        let error = std::fs::read_to_string("./static/style.css").expect("unable to read style.css");
+        panic!(error);
+    }
+}
diff --git a/backend/conf.ron b/backend/conf.ron
new file mode 100644 (file)
index 0000000..8e0926d
--- /dev/null
@@ -0,0 +1,3 @@
+(\r
+    port: 8082,\r
+)
\ No newline at end of file
diff --git a/backend/static/style.css b/backend/static/style.css
deleted file mode 100644 (file)
index 6fad26a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-* {
-  margin: 50px;
-  padding: 0px;
-}
-
-body {
-   font-size: 18px;
-   font-family: 'Lobster Two';
-   text-shadow: 2px 2px 2px #DDD;
-   text-align: center;
-   line-height: 30px;
-   color: #5b5b5b;
-   background-color: #ededed;
-   margin: 0px;
-}
-
-img {
-  border: 0px;
-}
-
diff --git a/backend/style.scss b/backend/style.scss
new file mode 100644 (file)
index 0000000..6fad26a
--- /dev/null
@@ -0,0 +1,20 @@
+* {
+  margin: 50px;
+  padding: 0px;
+}
+
+body {
+   font-size: 18px;
+   font-family: 'Lobster Two';
+   text-shadow: 2px 2px 2px #DDD;
+   text-align: center;
+   line-height: 30px;
+   color: #5b5b5b;
+   background-color: #ededed;
+   margin: 0px;
+}
+
+img {
+  border: 0px;
+}
+
diff --git a/conf.ron b/conf.ron
deleted file mode 100644 (file)
index 8e0926d..0000000
--- a/conf.ron
+++ /dev/null
@@ -1,3 +0,0 @@
-(\r
-    port: 8082,\r
-)
\ No newline at end of file