mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 03:29:31 +08:00
Get rid of plugins.css, inject it using DiscourseSassImporter.
This commit is contained in:
parent
8c129e480a
commit
33307a50b3
|
@ -8,3 +8,6 @@
|
||||||
@import "common/components/*";
|
@import "common/components/*";
|
||||||
@import "common/admin/*";
|
@import "common/admin/*";
|
||||||
@import "common/input_tip";
|
@import "common/input_tip";
|
||||||
|
|
||||||
|
/* This file doesn't actually exist, it is injected by DiscourseSassImporter. */
|
||||||
|
@import "plugins";
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
@import "common";
|
@import "common";
|
||||||
@import "mobile/*";
|
@import "mobile/*";
|
||||||
|
|
||||||
|
/* This file doesn't actually exist, it is injected by DiscourseSassImporter. */
|
||||||
|
@import "plugins_mobile";
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<%
|
|
||||||
# TODO this is very tricky, we want to add a dependency here on files that may not yet exist
|
|
||||||
# otherwise in dev we are often stuck nuking the tmp/cache directory
|
|
||||||
DiscoursePluginRegistry.stylesheets.each do |css|
|
|
||||||
require_asset(css)
|
|
||||||
end
|
|
||||||
%>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<%
|
|
||||||
# TODO this is very tricky, we want to add a dependency here on files that may not yet exist
|
|
||||||
# otherwise in dev we are often stuck nuking the tmp/cache directory
|
|
||||||
DiscoursePluginRegistry.mobile_stylesheets.each do |css|
|
|
||||||
require_asset(css)
|
|
||||||
end
|
|
||||||
%>
|
|
|
@ -1,10 +1,8 @@
|
||||||
<%- unless SiteCustomization.override_default_style(session[:preview_style]) %>
|
<%- unless SiteCustomization.override_default_style(session[:preview_style]) %>
|
||||||
<% if mobile_view? %>
|
<% if mobile_view? %>
|
||||||
<%= stylesheet_link_tag "mobile" %>
|
<%= stylesheet_link_tag "mobile" %>
|
||||||
<%= stylesheet_link_tag "plugins_mobile" %>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= stylesheet_link_tag "desktop" %>
|
<%= stylesheet_link_tag "desktop" %>
|
||||||
<%= stylesheet_link_tag "plugins" %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ module Discourse
|
||||||
path =~ /assets\/images/ && !%w(.js .css).include?(File.extname(filename))
|
path =~ /assets\/images/ && !%w(.js .css).include?(File.extname(filename))
|
||||||
end]
|
end]
|
||||||
|
|
||||||
config.assets.precompile += ['vendor.js', 'common.css', 'desktop.css', 'mobile.css', 'admin.js', 'admin.css', 'shiny/shiny.css', 'preload_store.js', 'browser-update.js', 'embed.css', 'break_string.js', 'plugins.css', 'plugins_mobile.css']
|
config.assets.precompile += ['vendor.js', 'common.css', 'desktop.css', 'mobile.css', 'admin.js', 'admin.css', 'shiny/shiny.css', 'preload_store.js', 'browser-update.js', 'embed.css', 'break_string.js']
|
||||||
|
|
||||||
# Precompile all defer
|
# Precompile all defer
|
||||||
Dir.glob("#{config.root}/app/assets/javascripts/defer/*.js").each do |file|
|
Dir.glob("#{config.root}/app/assets/javascripts/defer/*.js").each do |file|
|
||||||
|
|
|
@ -35,7 +35,20 @@ class DiscourseSassImporter < Sass::Importers::Filesystem
|
||||||
end
|
end
|
||||||
|
|
||||||
def find(name, options)
|
def find(name, options)
|
||||||
if name =~ GLOB
|
if name == "plugins" || name == "plugins_mobile"
|
||||||
|
if name == "plugins"
|
||||||
|
stylesheets = DiscoursePluginRegistry.stylesheets
|
||||||
|
elsif name == "plugins_mobile"
|
||||||
|
stylesheets = DiscoursePluginRegistry.mobile_stylesheets
|
||||||
|
end
|
||||||
|
contents = ""
|
||||||
|
stylesheets.each {|css| contents << File.read(css) }
|
||||||
|
Sass::Engine.new(contents, options.merge(
|
||||||
|
filename: "#{name}.scss",
|
||||||
|
importer: self,
|
||||||
|
syntax: :scss
|
||||||
|
))
|
||||||
|
elsif name =~ GLOB
|
||||||
nil # globs must be relative
|
nil # globs must be relative
|
||||||
else
|
else
|
||||||
engine_from_path(name, root, options)
|
engine_from_path(name, root, options)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user