mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 19:54:14 +08:00
DEV: Use separate files for theme component stylesheets (#12214)
This switches to outputting a separate file for each theme component CSS asset. We have separate CSS plugin files, separate JS files (for plugins/themes/components), it makes sense to do the same for component CSS assets. Benefits: - easier debugging - fixes a regression with theme component sourcemaps - changes to theme components are updated individually With HTTP/2, there is also no performance downside to having additional files in the initial request.
This commit is contained in:
@ -194,18 +194,13 @@ module Stylesheet
|
||||
fields.map do |field|
|
||||
value = field.value
|
||||
if value.present?
|
||||
filename = "theme_#{field.theme.id}/#{field.target_name}-#{field.name}-#{field.theme.name.parameterize}.scss"
|
||||
contents << <<~COMMENT
|
||||
// Theme: #{field.theme.name}
|
||||
// Target: #{field.target_name} #{field.name}
|
||||
// Last Edited: #{field.updated_at}
|
||||
COMMENT
|
||||
|
||||
if field.theme_id == theme.id
|
||||
contents << value
|
||||
else
|
||||
contents << field.compiled_css(prepended_scss)
|
||||
end
|
||||
contents << value
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -58,7 +58,7 @@ class Stylesheet::Manager
|
||||
|
||||
theme_ids = [theme_ids] unless Array === theme_ids
|
||||
theme_ids = [theme_ids.first] unless target =~ THEME_REGEX
|
||||
theme_ids = Theme.transform_ids(theme_ids, extend: false)
|
||||
theme_ids = Theme.transform_ids(theme_ids)
|
||||
|
||||
current_hostname = Discourse.current_hostname
|
||||
|
||||
|
Reference in New Issue
Block a user