Workaround for bootstrap-sass
The change in assets.rb should be enough, but it doesn't work, because sprockets `after_initialize` runs before it and initializes sprockets with unfiltered paths. But the trick with the underscore works, because bootstrap-sass has named the file `_bootstrap.scss`, and rails-assets-bootstrap has `bootstrap.scss`, so with `_bootstrap` it uses the correct bootstrap.
This commit is contained in:
parent
b80d324504
commit
b203862ca3
2 changed files with 11 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
// Calling this file bootstrap would cause an infinite recursion during asset compilation.
|
// Calling this file bootstrap would cause an infinite recursion during asset compilation.
|
||||||
@import "bootstrap-sprockets";
|
@import "bootstrap-sprockets";
|
||||||
@import "bootstrap-variables"; //our overwrites of bootstrap variables
|
@import "bootstrap-variables"; //our overwrites of bootstrap variables
|
||||||
@import "bootstrap";
|
@import "_bootstrap";
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,16 @@
|
||||||
# bootstrap-markdown plugin relies on rails-assets-bootstrap gem but we use
|
# bootstrap-markdown plugin relies on rails-assets-bootstrap gem but we use
|
||||||
# bootstrap-sass this line makes sure we exclude every asset comming
|
# bootstrap-sass this line makes sure we exclude every asset comming
|
||||||
# from rails-assets-bootstrap to prevent conflicts with bootstrap-sass
|
# from rails-assets-bootstrap to prevent conflicts with bootstrap-sass
|
||||||
Rails.configuration.assets.paths.reject! do |path|
|
|
||||||
path.include?("rails-assets-bootstrap") && !path.include?("rails-assets-bootstrap-markdown")
|
# See https://github.com/tenex/rails-assets/issues/314
|
||||||
|
Rails.application.config.after_initialize do
|
||||||
|
# add the gem names you wish to reject to the below array
|
||||||
|
excluded_gem_names = ["rails-assets-bootstrap"]
|
||||||
|
|
||||||
|
excluded_gem_full_names = Gem::Specification.select {|g| excluded_gem_names.include? g.name }.flat_map(&:full_name)
|
||||||
|
Rails.application.config.assets.paths.reject! do |path|
|
||||||
|
excluded_gem_full_names.any? {|gem_name| path.include? gem_name }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Version of your assets, change this if you want to expire all your assets.
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue