Skip to content

Commit

Permalink
Refactor css implementation (#6)
Browse files Browse the repository at this point in the history
Moves CSS from static files in the `public/assets` folder to the asset
pipeline.

Notes:

* I removed the `heroku-deflater` gem due to an asset compilation bug I
encountered on Heroku. The gem has [an open
issue](romanbsd/heroku-deflater#54), but it
doesn't seem worth worrying about right now (I'll likely use Cloudflare
eventually, which will handle the PageSpeed requirement for gzip
compression).
  • Loading branch information
seanmack committed Sep 12, 2023
1 parent fe5c26a commit c98d9e3
Show file tree
Hide file tree
Showing 28 changed files with 44 additions and 64 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ gem "bootsnap", require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

gem "heroku-deflater", group: :production

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[mri mingw x64_mingw]
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ GEM
erubi (1.12.0)
globalid (1.2.1)
activesupport (>= 6.1)
heroku-deflater (0.6.3)
rack (>= 1.4.5)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
importmap-rails (1.2.1)
Expand Down Expand Up @@ -288,7 +286,6 @@ DEPENDENCIES
bootsnap
capybara
debug
heroku-deflater
importmap-rails
jbuilder
pg (~> 1.1)
Expand Down
15 changes: 15 additions & 0 deletions app/assets/stylesheets/theme_1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS
* files in this directory. Styles in this file should be added after the last require_* statement.
* It is generally better to create a new file per style scope.
*
*= require_tree ../theme_1/stylesheets
*= require_self
*/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions app/views/layouts/static.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,11 @@
-->

<!-- Sitewide Stylesheets and Scripts -->
<link rel="stylesheet" href="/assets/css/root.css">
<link rel="stylesheet" href="/assets/css/dark.css">
<%= stylesheet_link_tag "theme_1", "data-turbo-track": "reload" %>
<script defer src="/assets/js/nav.js"></script>
<script defer src="/assets/js/dark.js"></script>

<!-- {% block head %}{% endblock %} -->
<% if content_for? :for_head %>
<%= yield :for_head %>
<% end %>

<!--For home page, use service keywords for the title, including location for SEO.
Other pages should just include the page name.
Expand Down
4 changes: 0 additions & 4 deletions app/views/static/about.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ eleventyNavigation:
---
-->

<% content_for :for_head do %>
<link rel="stylesheet" href="/assets/css/about.css">
<% end %>

<!-- {% block body %} -->
<!-- ============================================ -->
<!-- LANDING -->
Expand Down
3 changes: 0 additions & 3 deletions app/views/static/blog.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

<% content_for :for_head do %>
<link rel="stylesheet" href="/assets/css/blog.css">
<% end %>
<!-- ============================================ -->
<!-- LANDING -->
<!-- ============================================ -->
Expand Down
4 changes: 0 additions & 4 deletions app/views/static/contact.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ preloadImg: '/assets/images/cabinets2.jpg'
permalink: 'contact/'
---
-->
<% content_for :for_head do %>
<link rel="stylesheet" href="/assets/css/contact.css">
<% end %>

<!-- ============================================ -->
<!-- LANDING -->
<!-- ============================================ -->
Expand Down
5 changes: 0 additions & 5 deletions app/views/static/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ eleventyNavigation:
---
-->

<% content_for :for_head do %>
<link rel="stylesheet" href="/assets/css/local.css" />
<link rel="stylesheet" href="/assets/css/critical.css" />
<% end %>

<!-- {% block body %} -->

<!-- ============================================ -->
Expand Down
4 changes: 0 additions & 4 deletions app/views/static/projects.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ eleventyNavigation:
---
-->

<% content_for :for_head do %>
<link rel="stylesheet" href="/assets/css/projects.css">
<% end %>

<!-- ============================================ -->
<!-- LANDING -->
<!-- ============================================ -->
Expand Down
4 changes: 0 additions & 4 deletions app/views/static/reviews.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ eleventyNavigation:
---
-->

<% content_for :for_head do %>
<link rel="stylesheet" href="/assets/css/reviews.css">
<% end %>

<!-- ============================================ -->
<!-- LANDING -->
<!-- ============================================ -->
Expand Down
1 change: 0 additions & 1 deletion public/assets/css/about.css.map

This file was deleted.

1 change: 0 additions & 1 deletion public/assets/css/blog.css.map

This file was deleted.

1 change: 0 additions & 1 deletion public/assets/css/contact.css.map

This file was deleted.

1 change: 0 additions & 1 deletion public/assets/css/critical.css.map

This file was deleted.

1 change: 0 additions & 1 deletion public/assets/css/dark.css.map

This file was deleted.

1 change: 0 additions & 1 deletion public/assets/css/local.css.map

This file was deleted.

1 change: 0 additions & 1 deletion public/assets/css/projects.css.map

This file was deleted.

Loading

0 comments on commit c98d9e3

Please sign in to comment.