Skip to content

Commit

Permalink
Re-organize project files
Browse files Browse the repository at this point in the history
Attempt to simplify the layout of project files.
  • Loading branch information
0x1eef committed Oct 8, 2023
1 parent 4f4b5a2 commit ccb871c
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 42 deletions.
8 changes: 4 additions & 4 deletions Rules
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ end
##
# Require rules
require_rules "nanoc/rules/assets"
require_rules "nanoc/rules/pages/surah/redirect"
require_rules "nanoc/rules/pages/surah/stream", {locales:, i18n:, slugs:}
require_rules "nanoc/rules/pages/surah/index", {locales:, i18n:}
require_rules "nanoc/rules/pages/surah/random", {locales:, i18n:, slugs:}
require_rules "nanoc/rules/redirect"
require_rules "nanoc/rules/random", {locales:, i18n:, slugs:}
require_rules "nanoc/rules/stream", {locales:, i18n:, slugs:}
require_rules "nanoc/rules/index", {locales:, i18n:}

##
# Defaults
Expand Down
16 changes: 8 additions & 8 deletions nanoc/rules/pages/surah/index.rules → nanoc/rules/index.rules
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
# dependencies.

locales.each do |locale|
compile "/html/pages/surah/index.html.erb", rep: "/#{locale}/surah/index" do
compile "/html/index.html.erb", rep: "/#{locale}/surah/index" do
context = Ryo.from(locale:)
filter(:erb, locals: {context:})
filter(:tidy)
write "/#{locale}/index.html"
end
end

compile "/js/pages/surah/index.tsx" do
compile "/js/pages/SurahIndex.tsx" do
filter :webpack, depend_on: ["/js/components",
"/js/lib/[!WebPackage]/",
"/js/hooks"]
write "/js/pages/surah/index.js"
write "/js/pages/surah-index.js"
filter :gzip
write "/js/pages/surah/index.js.gz"
write "/js/pages/surah-index.js.gz"
end

compile "/js/pages/surah/index/loader.ts" do
compile "/js/loaders/SurahIndexLoader.ts" do
filter :webpack, depend_on: "/js/lib/WebPackage"
write "/js/pages/surah/index/loader.js"
write "/js/loaders/surah-index-loader.js"
end

compile "/css/pages/surah/index.scss" do
compile "/css/pages/SurahIndex.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
write("/css/pages/surah/index.css")
write("/css/pages/surah-index.css")
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
# (eg /en/random/ -> /en/al-kahf/)

locales.each do |locale|
compile "/html/pages/surah/random.html.erb", rep: "random/#{locale}" do
compile "/html/random.html.erb", rep: "random/#{locale}" do
title = i18n[locale].TheNobleQuran
filter(:erb, locals: {locale:, title:})
write("/#{locale}/random/index.html")
end
end

compile "/js/pages/surah/random.ts" do
filter :webpack
write "/js/pages/surah/random.js"
compile "/js/pages/Random.ts" do
filter(:webpack)
write("/js/pages/random.js")
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# Rules for a redirect from the root path to the surah index for a given locale
# (eg / -> /en/)

compile "/html/pages/surah/redirect.html.erb" do
compile "/html/redirect.html.erb" do
filter(:erb)
write("/index.html")
end

compile "/js/pages/surah/redirect.ts" do
compile "/js/pages/Redirect.ts" do
filter(:webpack)
write("/js/pages/surah/redirect.js")
write("/js/pages/redirect.js")
end
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ Ryo.each(slugs) do |id, slug|
write "/#{locale}/#{identifier}/index.html"
end
locales.each do |locale|
compile "/html/pages/surah/stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
compile "/html/stream.html.erb", rep: "/#{locale}/#{slug}/index.html" do
instance_exec(locale, identifier: slug, &writer)
end
compile "/html/pages/surah/stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
compile "/html/stream.html.erb", rep: "/#{locale}/#{id}/index.html" do
instance_exec(locale, identifier: id, &writer)
end
end
end

compile "/js/pages/surah/stream.tsx" do
compile "/js/pages/SurahStream.tsx" do
filter :webpack,
depend_on: ["/js/components", "/js/lib/", "/js/hooks"],
reject: proc { _1.include?("WebPackage") }
write "/js/pages/surah/stream.js"
write "/js/pages/surah-stream.js"
filter :gzip
write "/js/pages/surah/stream.js.gz"
write "/js/pages/surah-stream.js.gz"
end

compile "/js/pages/surah/stream/loader.ts" do
compile "/js/loaders/SurahStreamLoader.ts" do
filter :webpack, depend_on: "/js/lib/WebPackage"
write "/js/pages/surah/stream/loader.js"
write "/js/loaders/surah-stream-loader.js"
end

compile "/css/pages/surah/stream.scss" do
compile "/css/pages/SurahStream.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
write("/css/pages/surah/stream.css")
write("/css/pages/surah-stream.css")
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@import "layout";
@import "components/Select";
@import "themes/moon";
@import "themes/leaf";

ul.body.index {
display: flex;
Expand Down Expand Up @@ -67,3 +65,6 @@ body .root .content.theme.ar {
}
}
}

@import "themes/moon";
@import "themes/leaf";
File renamed without changes.
4 changes: 2 additions & 2 deletions src/css/themes/leaf.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "leaf/layout";
@import "leaf/pages/surah/index";
@import "leaf/pages/surah/stream";
@import "leaf/pages/SurahIndex";
@import "leaf/pages/SurahStream";

.root .content.theme.leaf.ar {
direction: rtl;
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/css/themes/moon.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "moon/layout";
@import "moon/pages/surah/index";
@import "moon/pages/surah/stream";
@import "moon/pages/SurahIndex";
@import "moon/pages/SurahStream";

.root .content.theme.moon.ar {
direction: rtl;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<div class="root" data-locale="<%= context.locale %>"></div>
<%= inline_json("/i18n.json") %>
<%= inline_json("/surahs.json") %>
<script src="/js/pages/surah/index/loader.js"></script>
<script src="/js/loaders/surah-index-loader.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</head>
<body>
<%= inline_json("/slugs.json") %>
<script src="/js/pages/surah/random.js"></script>
<script src="/js/pages/random.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<head>
<title>Al-Quran</title>
<link rel="icon" href="/favicon.png">
<script src="/js/pages/surah/redirect.js"></script>
<script src="/js/pages/redirect.js"></script>
</head>
<body></body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
</div>
<%= inline_json("/i18n.json") %>
<%= inline_json("/reciters.json") %>
<script src="/js/pages/surah/stream/loader.js"></script>
<script src="/js/loaders/surah-stream-loader.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import postman, { item } from "postman";
const inlineStyle: HTMLStyleElement = document.querySelector(".css.postman")!;

postman(
item.script("/js/pages/surah/index.js"),
item.css("/css/pages/surah/index.css"),
item.script("/js/pages/surah-index.js"),
item.css("/css/pages/surah-index.css"),
item.image("/images/moon.svg"),
item.image("/images/leaf.svg"),
item.font("Kanit Regular", "url(/fonts/kanit-regular.ttf)"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import * as Quran from "lib/Quran";
);

postman(
item.script("/js/pages/surah/stream.js"),
item.css("/css/pages/surah/stream.css"),
item.script("/js/pages/surah-stream.js"),
item.css("/css/pages/surah-stream.css"),
item.image("/images/moon.svg"),
item.image("/images/leaf.svg"),
item.font("Kanit Regular", "url(/fonts/kanit-regular.ttf)"),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ccb871c

Please sign in to comment.