Resolve custom application stylesheet with Webpack (#3373)
This implementation is a bit smaller and still has the following benefits: * No need of app/javascript/packs/custom.js For custom stylesheet, it typically has only "require('../styles/custom.scss')" and is redundant. * No need to extract vendor stylesheet to another asset Extracting vendor stylesheet could be forgotten by developers who do not use custom stylesheet.th-downstream
parent
eea027c5c2
commit
6b0fdf95b9
@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module StyleHelper
|
||||
def stylesheet_for_layout
|
||||
if asset_exist? 'custom.css'
|
||||
'custom'
|
||||
else
|
||||
'application'
|
||||
end
|
||||
end
|
||||
|
||||
def asset_exist?(path)
|
||||
true if Webpacker::Manifest.lookup(path)
|
||||
rescue Webpacker::FileLoader::NotFoundError
|
||||
false
|
||||
end
|
||||
end
|
Loading…
Reference in new issue