mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Compile theme raw-hbr to modules (#30299)
Previously, theme hbr files were compiled to an IIFE, which would be executed before the app is booted. That is causing silenced deprecations to be printed, because the deprecation-workflow isn't set up when the IIFE is run. This commit updates the theme compiler so that it matches the ember-cli-based raw-hbs compiler. Templates are output to normal modules, which will then be loaded by the existing `eager-load-raw-templates` initializer. This runs after the app has started booting.
This commit is contained in:
@ -8,15 +8,15 @@ RSpec.describe ThemeJavascriptCompiler do
|
||||
template = "<h1>hello</h1>"
|
||||
name = "/path/to/templates1"
|
||||
compiler.append_raw_template("#{name}.raw", template)
|
||||
expect(compiler.raw_content.to_s).to include("addRawTemplate(\"#{name}\"")
|
||||
expect(compiler.raw_content.to_s).to include("addRawTemplate)(\"#{name}\"")
|
||||
|
||||
name = "/path/to/templates2"
|
||||
compiler.append_raw_template("#{name}.hbr", template)
|
||||
expect(compiler.raw_content.to_s).to include("addRawTemplate(\"#{name}\"")
|
||||
expect(compiler.raw_content.to_s).to include("addRawTemplate)(\"#{name}\"")
|
||||
|
||||
name = "/path/to/templates3"
|
||||
compiler.append_raw_template("#{name}.hbs", template)
|
||||
expect(compiler.raw_content.to_s).to include("addRawTemplate(\"#{name}.hbs\"")
|
||||
expect(compiler.raw_content.to_s).to include("addRawTemplate)(\"#{name}.hbs\"")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user