diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index 7542c7c..0000000
--- a/.babelrc
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-"presets": [
- "@babel/typescript",
- "@babel/preset-env",
- ["@babel/preset-react", {"runtime": "automatic"}]
- ]
-}
diff --git a/.env.sample b/.env.sample
deleted file mode 100644
index 4941fee..0000000
--- a/.env.sample
+++ /dev/null
@@ -1,5 +0,0 @@
-export DEPLOY_HOSTNAME=
-export DEPLOY_USERNAME=
-export DEPLOY_PATH=
-export NODE_ENV=
-export SASS_PATH="${SASS_PATH}:./src/css"
diff --git a/.gitignore b/.gitignore
index 3c15380..966f29e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,7 @@
-build/
-tmp/
+/build/
+/tmp/
+/rake/tasks/deploy.rake
+/.gems/
+/crash.log
node_modules/
-.gems/
-.dev/
-*.log
-.env
-.idea
-*.conf
-*.yml
-*.mp3
-*.sh
*.core
diff --git a/README.md b/README.md
index 40e7072..6bd21be 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
## About
This repository contains the source code of
-[al-quran.reflectslight.io](https://al-quran.reflectslight.io),
+[al-quran.reflectslight.io](https://al-quran.reflectslight.io) -
a static website for reading (and listening to) The Noble Quran.
After the website is built, the build directory consists of HTML,
CSS, JavaScript and other static assets that can be hosted by a
-regular web server (eg nginx, apache, etc).
+standard web server (eg nginx, apache, ...).
## Stack
@@ -18,28 +18,20 @@ the website can be built:
There is a good chance there's a package available for
tidy-html5 on your operating system of choice.
-## Local development
-
-__1. Clone__
+## Development
+ # Clone repository
git clone https://github.com/ReflectsLight/al-quran.git
cd al-quran
-__2. Install Ruby, NodeJS packages__
-
+ # Install Ruby, NodeJS packages
bundle install
npm i
-__3. Build website__
-
- # Build once
- rake build
-
- # Build whenever a change is detected
- rake build:watch
-
-__4. Start server on localhost__
+ # Build website
+ rake nanoc:build
+ # Start web server
rake server
## Thanks
@@ -47,9 +39,14 @@ __4. Start server on localhost__
First and foremost, Alhamdulillah.
* Thanks to the following graphic artists:
- * [RefreshIcon](/src/js/components/Icon.tsx)
- by
- [Muhammad Haq](https://freeicons.io/profile/823).
+ - [RefreshIcon](/src/js/components/Icon.tsx)
+ by
+ [Muhammad Haq](https://freeicons.io/profile/823).
* Thanks to the following translators:
- * English (The Clear Quran) by Dr. Mustafa Khattab
+ - English (The Clear Quran) by Dr. Mustafa Khattab
+
+## License
+
+The "source code" is released under the terms of the GPL.
+See [./LICENSE](./LICENSE) for details.
diff --git a/Rules b/Rules
index 4b43015..855ad90 100644
--- a/Rules
+++ b/Rules
@@ -9,12 +9,12 @@ require "nanoc-tidy"
locales = %w[ar en]
slugs = Ryo.from(
JSON.parse(
- File.read(File.join(Dir.getwd, "src", "slugs.json"))
+ File.read(File.join(Dir.getwd, "src", "json", "slugs.json"))
)
)
i18n = Ryo.from(
JSON.parse(
- File.read(File.join(Dir.getwd, "src", "i18n.json"))
+ File.read(File.join(Dir.getwd, "src", "json", "i18n.json"))
)
)
diff --git a/bin/build-favicons b/bin/build-favicons
deleted file mode 100755
index 08cf824..0000000
--- a/bin/build-favicons
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-sizes="16x16 32x32 48x48 64x64 128x128 256x256"
-for size in ${sizes}; do
- convert src/favicon.svg \
- -resize ${size} \
- -background none \
- -fuzz 8% \
- -mattecolor "#FFFFFF" \
- -alpha set \
- -channel RGBA \
- -fill none \
- -opaque white \
- -gravity center \
- -extent ${size} \
- png32:src/favicon-${size}.png
-done
diff --git a/nanoc/lib/mixin/t.rb b/nanoc/lib/mixin/t.rb
index e1861a3..4a1ce63 100644
--- a/nanoc/lib/mixin/t.rb
+++ b/nanoc/lib/mixin/t.rb
@@ -9,7 +9,7 @@ module Mixin::T
end
def i18n
- path = File.join(Dir.getwd, "src", "i18n.json")
+ path = File.join(Dir.getwd, "src", "json", "i18n.json")
json = File.binread(path)
Ryo.from JSON.parse(json)
end
diff --git a/nanoc/rules/assets.rules b/nanoc/rules/assets.rules
index 67edff6..eb70007 100644
--- a/nanoc/rules/assets.rules
+++ b/nanoc/rules/assets.rules
@@ -20,7 +20,7 @@ compile "/images/*.svg" do
write("#{item.identifier}.gz")
end
-compile "/favicon*.png" do
+compile "/images/*.png" do
write(item.identifier.to_s)
end
diff --git a/nanoc/rules/index.rules b/nanoc/rules/index.rules
index 0f40cc2..0dfd3bd 100644
--- a/nanoc/rules/index.rules
+++ b/nanoc/rules/index.rules
@@ -2,8 +2,7 @@
# frozen_string_literal: true
##
-# Rules for the surah index available at // (eg /en/) and its
-# dependencies.
+# Rules for the surah index available at //.
locales.each do |locale|
compile "/html/index.html.erb", rep: "/#{locale}/surah/index" do
@@ -14,17 +13,17 @@ locales.each do |locale|
end
end
-compile "/js/pages/SurahIndex.tsx" do
+compile "/js/main/surah-index.tsx" do
filter :webpack, depend_on: ["/js/components",
- "/js/lib/[!WebPackage]/",
+ "/js/lib/",
"/js/hooks"]
- write "/js/surah-index.js"
+ write "/js/main/surah-index.js"
filter :gzip
- write "/js/surah-index.js.gz"
+ write "/js/main/surah-index.js.gz"
end
compile "/js/loaders/SurahIndexLoader.ts" do
- filter :webpack, depend_on: "/js/lib/WebPackage"
+ filter :webpack
write "/js/loaders/surah-index-loader.js"
end
diff --git a/nanoc/rules/random.rules b/nanoc/rules/random.rules
index 728449b..9186b9c 100644
--- a/nanoc/rules/random.rules
+++ b/nanoc/rules/random.rules
@@ -14,7 +14,7 @@ locales.each do |locale|
end
end
-compile "/js/pages/Random.ts" do
+compile "/js/main/random.ts" do
filter(:webpack)
- write("/js/random.js")
+ write("/js/main/random.js")
end
diff --git a/nanoc/rules/redirect.rules b/nanoc/rules/redirect.rules
index 0eccf14..8273425 100644
--- a/nanoc/rules/redirect.rules
+++ b/nanoc/rules/redirect.rules
@@ -2,8 +2,8 @@
# frozen_string_literal: true
##
-# Rules for a redirect from the root path to the surah index for a given locale
-# (eg / -> /en/)
+# Rules for a redirect from the root path to the surah index
+# for a given locale (eg / -> /en/).
compile "/html/redirect.html.erb" do
filter(:tidy)
@@ -11,7 +11,7 @@ compile "/html/redirect.html.erb" do
write("/index.html")
end
-compile "/js/pages/Redirect.ts" do
+compile "/js/main/redirect.ts" do
filter(:webpack)
- write("/js/redirect.js")
+ write("/js/main/redirect.js")
end
diff --git a/nanoc/rules/stream.rules b/nanoc/rules/stream.rules
index 31efcb8..86d9c1a 100644
--- a/nanoc/rules/stream.rules
+++ b/nanoc/rules/stream.rules
@@ -2,8 +2,7 @@
# frozen_string_literal: true
##
-# Rules for the surah stream available at /// (eg /ar/al-fatihah/)
-# and its dependencies.
+# Rules for the surah stream available at ///.
compile "/*/*/surah.json" do
write(item.identifier.to_s)
@@ -36,17 +35,17 @@ Ryo.each(slugs) do |id, slug|
end
end
-compile "/js/pages/SurahStream.tsx" do
+compile "/js/main/surah-stream.tsx" do
filter :webpack,
depend_on: ["/js/components", "/js/lib/", "/js/hooks"],
reject: proc { _1.include?("WebPackage") }
- write "/js/surah-stream.js"
+ write "/js/main/surah-stream.js"
filter :gzip
- write "/js/surah-stream.js.gz"
+ write "/js/main/surah-stream.js.gz"
end
compile "/js/loaders/SurahStreamLoader.ts" do
- filter :webpack, depend_on: "/js/lib/WebPackage"
+ filter :webpack
write "/js/loaders/surah-stream-loader.js"
end
diff --git a/rake/tasks/deploy.rake b/rake/tasks/deploy.rake
deleted file mode 100644
index 3a86a16..0000000
--- a/rake/tasks/deploy.rake
+++ /dev/null
@@ -1,27 +0,0 @@
-##
-# frozen_string_literal: true
-
-desc "Configure environment for deployment"
-task "deploy:env" do
- ENV["buildenv"] = "production"
- print "Set $NODE_ENV to 'production'", "\n"
-end
-
-desc "Deploy the website"
-task "deploy" => %i[deploy:env nanoc:clean nanoc:build] do
- git_branch = `git branch --show-current`.chomp
- if git_branch != "production"
- warn "This task must be run on the 'production' branch."
- exit(1)
- end
- print "Wait...", "\n"
- sh(
- "rsync",
- "--delete", "-rvah",
- "--chmod=Fu=r,Fg=r,Du=rx,Dg=rx",
- "--rsync-path='/home/0x1eef/rsync.sh'",
- "--exclude=audio/",
- "build/al-quran/",
- "0x1eef@al-quran.reflectslight.io:/mnt/www/al-quran.reflectslight.io/"
- )
-end
diff --git a/src/html/index.html.erb b/src/html/index.html.erb
index 05e18ce..1576d65 100644
--- a/src/html/index.html.erb
+++ b/src/html/index.html.erb
@@ -30,8 +30,8 @@
- <%= inline_json("/i18n.json") %>
- <%= inline_json("/surahs.json") %>
+ <%= inline_json("/json/i18n.json") %>
+ <%= inline_json("/json/surahs.json") %>