summaryrefslogtreecommitdiff
path: root/pkgs/servers/web-apps/discourse/prebuild-theme-transpiler.patch
blob: 2e779fa2640061c57261ef984cc1098be8f619ec (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/lib/discourse_js_processor.rb b/lib/discourse_js_processor.rb
index f1642386c5..5a672818da 100644
--- a/lib/discourse_js_processor.rb
+++ b/lib/discourse_js_processor.rb
@@ -54,7 +54,7 @@ class DiscourseJsProcessor
   end

   class Transpiler
-    TRANSPILER_PATH = "tmp/theme-transpiler.js"
+    TRANSPILER_PATH = "app/assets/javascripts/theme-transpiler.js"

     @mutex = Mutex.new
     @ctx_init = Mutex.new
@@ -75,7 +75,9 @@ class DiscourseJsProcessor
     end

     def self.build_production_theme_transpiler
-      File.write(TRANSPILER_PATH, build_theme_transpiler)
+      if (!Rails.env.production? or !File.file?(TRANSPILER_PATH))
+        File.write(TRANSPILER_PATH, build_theme_transpiler)
+      end
       TRANSPILER_PATH
     end