Skip to content

Commit

Permalink
Use a more standard assets configuration
Browse files Browse the repository at this point in the history
We namespace all our assets under `solidus_admin` to avoid conflicts. We
use an `application.css` manifest. From it, we require the compiled
tailwind css, which lives within `app/assets/builds` and is named
`tailwind.css`, just like tailwindcss-rails does with host apps.
  • Loading branch information
waiting-for-dev authored and elia committed Jul 11, 2023
1 parent 759190d commit 790470c
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions admin/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ namespace :solidus_admin do
require "solidus_admin/engine"
root = SolidusAdmin::Engine.root
system "#{Tailwindcss::Engine.root.join("exe/tailwindcss")} \
-i #{root.join("app/assets/stylesheets/application.tailwind.css")} \
-o #{root.join("app/assets/builds/solidus_admin.css")} \
-c #{root.join("config/tailwind.config.js")} \
-i #{root.join("app/assets/stylesheets/solidus_admin/application.tailwind.css")} \
-o #{root.join("app/assets/builds/solidus_admin/tailwind.css")} \
-c #{root.join("config/solidus_admin/tailwind.config.js")} \
--minify -w"
end
end
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion admin/app/assets/config/solidus_admin_manifest.js

This file was deleted.

3 changes: 3 additions & 0 deletions admin/app/assets/stylesheets/solidus_admin/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
* = require solidus_admin/tailwind.css
*/
2 changes: 1 addition & 1 deletion admin/app/views/layouts/solidus_admin/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<%= stylesheet_link_tag "solidus_admin", "data-turbo-track": "reload" %>
<%= stylesheet_link_tag "solidus_admin/application.css", "data-turbo-track": "reload" %>
</head>
<body>
<h1 class="text-4xl">Layout is rendered</h1>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion admin/lib/solidus_admin/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Engine < ::Rails::Engine
isolate_namespace SolidusAdmin

initializer "solidus_admin.assets" do |app|
app.config.assets.precompile += %w[solidus_admin_manifest]
app.config.assets.precompile += %w[solidus_admin/application.css]
end
end
end

0 comments on commit 790470c

Please sign in to comment.