mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -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);
|
$(this).data('orig', this.href);
|
||||||
}
|
}
|
||||||
const orig = $(this).data('orig');
|
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;
|
this.href = orig + (orig.indexOf('?') >= 0 ? "&hash=" : "?hash=") + me.hash;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,12 +27,14 @@ class Autospec::ReloadCss
|
||||||
if paths.any? { |p| p =~ /\.(css|s[ac]ss)/ }
|
if paths.any? { |p| p =~ /\.(css|s[ac]ss)/ }
|
||||||
# todo connect to dev instead?
|
# todo connect to dev instead?
|
||||||
ActiveRecord::Base.establish_connection
|
ActiveRecord::Base.establish_connection
|
||||||
s = DiscourseStylesheets.new(:desktop) # TODO: what about mobile?
|
[:desktop, :mobile].each do |style|
|
||||||
|
s = DiscourseStylesheets.new(style)
|
||||||
s.compile
|
s.compile
|
||||||
s.ensure_digestless_file
|
s.ensure_digestless_file
|
||||||
ActiveRecord::Base.clear_active_connections!
|
|
||||||
paths << "public" + s.stylesheet_relpath_no_digest
|
paths << "public" + s.stylesheet_relpath_no_digest
|
||||||
end
|
end
|
||||||
|
ActiveRecord::Base.clear_active_connections!
|
||||||
|
end
|
||||||
paths.map! do |p|
|
paths.map! do |p|
|
||||||
hash = nil
|
hash = nil
|
||||||
fullpath = "#{Rails.root}/#{p}"
|
fullpath = "#{Rails.root}/#{p}"
|
||||||
|
@ -41,7 +43,7 @@ class Autospec::ReloadCss
|
||||||
p = p.sub(/\.sass/, "")
|
p = p.sub(/\.sass/, "")
|
||||||
p = p.sub(/\.scss/, "")
|
p = p.sub(/\.scss/, "")
|
||||||
p = p.sub(/^app\/assets\/stylesheets/, "assets")
|
p = p.sub(/^app\/assets\/stylesheets/, "assets")
|
||||||
{ name: p, hash: hash }
|
{ name: p, hash: hash || SecureRandom.hex }
|
||||||
end
|
end
|
||||||
message_bus.publish "/file-change", paths
|
message_bus.publish "/file-change", paths
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue