A platform for community discussion. Free, open, simple.
PERF: Do not double bundle common langs in hljs bundle (#18321)
Rafael dos Santos Silvaedb201f55b21
diff --git a/lib/highlight_js.rb b/lib/highlight_js.rbindex f4c9c4f5c9b..8ad4f26264e 100644--- a/lib/highlight_js.rb+++ b/lib/highlight_js.rb@@ -2,6 +2,7 @@module HighlightJsHIGHLIGHTJS_DIR ||= "#{Rails.root}/vendor/assets/javascripts/highlightjs/"+ BUNDLED_LANGS = %w(bash c cpp csharp css diff go graphql ini java javascript json kotlin less lua makefile xml markdown objectivec perl php php-template plaintext python python-repl r ruby rust scss shell sql swift typescript vbnet wasm yaml)def self.languageslangs = Dir.glob(HIGHLIGHTJS_DIR + "languages/*.js").map do |path|@@ -13,7 +14,7 @@ module HighlightJsdef self.bundle(langs)result = File.read(HIGHLIGHTJS_DIR + "highlight.min.js")- langs.each do |lang|+ (langs - BUNDLED_LANGS).each do |lang|beginresult << "\n" << File.read(HIGHLIGHTJS_DIR + "languages/#{lang}.min.js")rescue Errno::ENOENT