Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add propshaft #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/views/layouts/super/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<% Super.configuration.stylesheets.each do |stylesheet| %>
<% if stylesheet.handler.sprockets? %>
<% if stylesheet.handler.sprockets? || stylesheet.handler.propshaft? %>
<%= stylesheet_link_tag(stylesheet.path, **stylesheet.arguments) %>
<% elsif stylesheet.handler.webpacker? %>
<%= stylesheet_pack_tag(stylesheet.path, **stylesheet.arguments) %>
<% end %>
<% end %>

<% Super.configuration.javascripts.each do |javascript| %>
<% if javascript.handler.sprockets? %>
<% if javascript.handler.sprockets? || javascript.handler.propshaft? %>
<%= javascript_include_tag(javascript.path) %>
<% elsif javascript.handler.webpacker? %>
<%= javascript_pack_tag(javascript.path) %>
Expand Down
20 changes: 20 additions & 0 deletions lib/super/assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def self.sprockets(path, **arguments)
Asset.new(handler: Handler.sprockets, path: path, arguments: arguments)
end

def self.propshaft(path, **arguments)
Asset.new(handler: Handler.propshaft, path: path, arguments: arguments)
end

def self.auto(path, **arguments)
Asset.new(handler: Handler.auto, path: path, arguments: arguments)
end
Expand Down Expand Up @@ -96,6 +100,14 @@ def auto
end
end

propshaft_spec = gem_specification("propshaft")
if propshaft_spec
minor = propshaft_spec.version.segments.second
if minor >= 7
return propshaft
end
end

webpacker_spec = gem_specification("webpacker")
if webpacker_spec
major = webpacker_spec.version.segments.first
Expand Down Expand Up @@ -124,6 +136,10 @@ def self.webpacker
@webpacker ||= new(:webpacker)
end

def self.propshaft
@propshaft ||= new(:propshaft)
end

def self.none
@none ||= new(:none)
end
Expand All @@ -140,6 +156,10 @@ def sprockets?
@asset_handler == :sprockets
end

def propshaft?
@asset_handler == :propshaft
end

def webpacker?
@asset_handler == :webpacker
end
Expand Down
1 change: 1 addition & 0 deletions super.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "webdrivers", "~> 4.3"
spec.add_development_dependency "puma", "~> 4.3", ">= 4.3.6"
spec.add_development_dependency "sqlite3"
# spec.add_development_dependency "propshaft"
spec.add_development_dependency "pry-rails"
spec.add_development_dependency "mocha"
spec.add_development_dependency "i18n-debug"
Expand Down