mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
fix live css changes on mobile
This commit is contained in:
parent
fe6203d4ec
commit
374f951c65
2 changed files with 11 additions and 5 deletions
|
@ -64,6 +64,10 @@ export default {
|
|||
$(this).data('orig', this.href);
|
||||
}
|
||||
const orig = $(this).data('orig');
|
||||
if (!me.hash) {
|
||||
window.__uniq = window.__uniq || 1;
|
||||
me.hash = window.__uniq++;
|
||||
}
|
||||
this.href = orig + (orig.indexOf('?') >= 0 ? "&hash=" : "?hash=") + me.hash;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -27,11 +27,13 @@ class Autospec::ReloadCss
|
|||
if paths.any? { |p| p =~ /\.(css|s[ac]ss)/ }
|
||||
# todo connect to dev instead?
|
||||
ActiveRecord::Base.establish_connection
|
||||
s = DiscourseStylesheets.new(:desktop) # TODO: what about mobile?
|
||||
s.compile
|
||||
s.ensure_digestless_file
|
||||
[:desktop, :mobile].each do |style|
|
||||
s = DiscourseStylesheets.new(style)
|
||||
s.compile
|
||||
s.ensure_digestless_file
|
||||
paths << "public" + s.stylesheet_relpath_no_digest
|
||||
end
|
||||
ActiveRecord::Base.clear_active_connections!
|
||||
paths << "public" + s.stylesheet_relpath_no_digest
|
||||
end
|
||||
paths.map! do |p|
|
||||
hash = nil
|
||||
|
@ -41,7 +43,7 @@ class Autospec::ReloadCss
|
|||
p = p.sub(/\.sass/, "")
|
||||
p = p.sub(/\.scss/, "")
|
||||
p = p.sub(/^app\/assets\/stylesheets/, "assets")
|
||||
{ name: p, hash: hash }
|
||||
{ name: p, hash: hash || SecureRandom.hex }
|
||||
end
|
||||
message_bus.publish "/file-change", paths
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue