Skip to content

Commit 86e972b

Browse files
committed
Merge branch 'main' into deployment
2 parents 181c36b + e35ee71 commit 86e972b

File tree

4 files changed

+20
-30
lines changed

4 files changed

+20
-30
lines changed

cfa_ui_components.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Gem::Specification.new do |spec|
1717
"lib/cfa_ui_components.rb",
1818
"lib/cfa_ui_components/**/*",
1919
"app/components/**/*",
20-
"app/assets/stylesheets/cfa_ui_components.tailwind.css"
20+
"app/assets/stylesheets/cfa_ui_components.tailwind.css",
21+
"lib/tasks/cfa_ui_components.rake"
2122
]
2223
spec.require_paths = [ "lib" ]
2324

config/environments/production.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
2222
# config.asset_host = "http://assets.example.com"
2323

24-
# Store uploaded files on the local file system (see config/storage.yml for options).
25-
config.active_storage.service = :local
26-
2724
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
2825
config.assume_ssl = true
2926

@@ -49,13 +46,6 @@
4946
# Replace the default in-process memory cache store with a durable alternative.
5047
config.cache_store = :memory_store
5148

52-
# Ignore bad email addresses and do not raise email delivery errors.
53-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
54-
# config.action_mailer.raise_delivery_errors = false
55-
56-
# Set host to be used by links generated in mailer templates.
57-
config.action_mailer.default_url_options = { host: "example.com" }
58-
5949
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
6050
# config.action_mailer.smtp_settings = {
6151
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
@@ -69,12 +59,6 @@
6959
# the I18n.default_locale when a translation cannot be found).
7060
config.i18n.fallbacks = true
7161

72-
# Do not dump schema after migrations.
73-
config.active_record.dump_schema_after_migration = false
74-
75-
# Only use :id for inspections in production.
76-
config.active_record.attributes_for_inspect = [ :id ]
77-
7862
# Enable DNS rebinding protection and other `Host` header attacks.
7963
# config.hosts = [
8064
# "example.com", # Allow requests from example.com

lib/cfa_ui_components/engine.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,5 @@ class Engine < ::Rails::Engine
1313
end
1414
end
1515

16-
initializer "cfa_ui_components.assets" do |app|
17-
if app.config.respond_to?(:assets)
18-
source_path = "#{root}/app/assets/stylesheets/cfa_ui_components.tailwind.css"
19-
dest_path = "#{Rails.root}/app/assets/stylesheets/cfa_ui_components.tailwind.css"
20-
21-
Tempfile.open do |temp_file|
22-
source_line = "@source \"#{root}\";\n\n"
23-
temp_file.write(source_line)
24-
temp_file.write(File.read(source_path))
25-
FileUtils.mv(temp_file.path, dest_path)
26-
end
27-
end
28-
end
2916
end
3017
end

lib/tasks/cfa_ui_components.rake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace :cfa_ui_components do
2+
desc "Copy the CfA UI Components stylesheet into the host application's stylesheets/vendors dir, with a @source directive that instructs Tailwind not to purge utility classes used in the components."
3+
task copy_gem_styles: :environment do
4+
gem_spec = Gem.loaded_specs["cfa_ui_components"]
5+
if gem_spec
6+
source = File.join(gem_spec.full_gem_path, 'app/assets/stylesheets/cfa_ui_components.tailwind.css')
7+
dest = Rails.root.join('app/assets/stylesheets/vendor/cfa_ui_components.tailwind.css')
8+
9+
FileUtils.mkdir_p(File.dirname(dest))
10+
Tempfile.open do |temp_file|
11+
source_line = "@source \"#{gem_spec.full_gem_path}\";\n\n"
12+
temp_file.write(source_line)
13+
temp_file.write(File.read(source))
14+
FileUtils.mv(temp_file.path, dest)
15+
end
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)