DEV: Clear local stylesheet caches when working on WCAG color schemes (#16600)

This isn't a complete fix, it doesn't enable live reloading of color
definition stylesheets. But at least now when working on WCAG overrides
the developer won't need to restart the server to see changes.
This commit is contained in:
Penar Musaraj 2022-05-02 18:49:47 -04:00 committed by GitHub
parent 4e65e02da6
commit 02fafc9476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -70,7 +70,7 @@ module Stylesheet
end end
target = nil target = nil
target_match = long.match(/admin|desktop|mobile|publish|wizard/) target_match = long.match(/admin|desktop|mobile|publish|wizard|wcag|color_definitions/)
if target_match&.length if target_match&.length
target = target_match[0] target = target_match[0]
end end
@ -93,6 +93,11 @@ module Stylesheet
end end
def core_assets_refresh(target) def core_assets_refresh(target)
if target.match(/wcag|color_definitions/)
Stylesheet::Manager.clear_color_scheme_cache!
return
end
targets = target ? [target] : ["desktop", "mobile", "admin"] targets = target ? [target] : ["desktop", "mobile", "admin"]
Stylesheet::Manager.clear_core_cache!(targets) Stylesheet::Manager.clear_core_cache!(targets)
message = targets.map! do |name| message = targets.map! do |name|