diff --git a/lib/nanoc/filters/minify_json.rb b/lib/nanoc/filters/minify_json.rb new file mode 100644 index 0000000..3718fdf --- /dev/null +++ b/lib/nanoc/filters/minify_json.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class Nanoc::Filters::MinifyJSON < Nanoc::Filter + require "json" + identifier :minify_json + type text: :text + + def run(content, options = {}) + JSON.dump(JSON.parse(content)) + end +end diff --git a/rules/pages/TheSurahIndex.rules b/rules/pages/TheSurahIndex.rules index 688d728..efa2b17 100644 --- a/rules/pages/TheSurahIndex.rules +++ b/rules/pages/TheSurahIndex.rules @@ -15,6 +15,7 @@ compile "/js/surah/index/redirect.ts" do end compile "/surahs.json" do + filter(:minify_json) write "/surahs.json" end