Skip to content

Commit f28a4d7

Browse files
committed
Various cleanup and tweaks.
- Remove unused files and try to document more of the new setup. - Reorganize and cleanup frontend assets. - Fix header icons wrapping to next line by themselves. Change so the icon always sticks to the last word. - Fixes for link `:visited` color bugs not working properly for nested SVG icons in Safari. - Various responsive style tweaks and improvements. - Fix large SVG logo flashing on page load/page change. - Add page layout to terms page, so it's more linkable. - Hook up favicons. - Fix contact form submission and setup for easier testing. - Remove middleman livereload, since it wasn't working and not sure it's worth messing with given the infrequency of development.
1 parent bc95108 commit f28a4d7

51 files changed

Lines changed: 315 additions & 742 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
.git
2-
tmp
3-
node_modules
1+
/.git
2+
/build
3+
/node_modules
4+
/tmp

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ ruby "~> 3.4.0"
44

55
# Middleman Gems
66
gem "middleman", "~> 4.6.0"
7-
gem "middleman-livereload", "~> 3.4.6"
87

98
# GitHub-flavored markdown.
109
gem "kramdown-parser-gfm", "~> 1.1.0"
@@ -27,4 +26,5 @@ gem "rake", "~> 13.0"
2726
# For making API calls to generate docs.
2827
gem "rest-client", "~> 2.1.0"
2928

29+
# Use Vite for assets.
3030
gem "vite_padrino", "~> 3.0.0"

Gemfile.lock

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ GEM
3030
dotenv (3.1.8)
3131
drb (2.2.1)
3232
dry-cli (1.2.0)
33-
em-websocket (0.5.3)
34-
eventmachine (>= 0.12.9)
35-
http_parser.rb (~> 0)
3633
erubi (1.13.1)
37-
eventmachine (1.2.7)
3834
execjs (2.10.0)
3935
fast_blank (1.0.1)
4036
fastimage (2.4.0)
@@ -51,7 +47,6 @@ GEM
5147
http-accept (1.7.0)
5248
http-cookie (1.0.8)
5349
domain_name (~> 0.5)
54-
http_parser.rb (0.8.0)
5550
i18n (1.14.7)
5651
concurrent-ruby (~> 1.0)
5752
kramdown (2.5.1)
@@ -98,10 +93,6 @@ GEM
9893
toml
9994
uglifier (>= 3, < 5)
10095
webrick
101-
middleman-livereload (3.4.7)
102-
em-websocket (~> 0.5.1)
103-
middleman-core (>= 3.3)
104-
rack-livereload (~> 0.3.15)
10596
middleman-syntax (3.5.0)
10697
middleman-core (>= 3.2)
10798
rouge (~> 3.2)
@@ -122,8 +113,6 @@ GEM
122113
parslet (2.0.0)
123114
public_suffix (6.0.1)
124115
rack (3.1.13)
125-
rack-livereload (0.3.17)
126-
rack
127116
rack-proxy (0.7.7)
128117
rack
129118
rackup (2.2.1)
@@ -174,7 +163,6 @@ DEPENDENCIES
174163
kramdown-parser-gfm (~> 1.1.0)
175164
middleman (~> 4.6.0)
176165
middleman-alias (~> 0.0.17)
177-
middleman-livereload (~> 3.4.6)
178166
middleman-syntax (~> 3.5.0)
179167
multi_json (~> 1.15.0)
180168
rake (~> 13.0)

config.rb

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,31 @@
55
###
66

77
# Per-page layout changes:
8-
#
8+
99
# With no layout
1010
page "/*.xml", layout: false
1111
page "/*.json", layout: false
1212
page "/*.txt", layout: false
1313

14-
# With alternative layout
15-
# page "/path/to/file.html", layout: :otherlayout
16-
17-
# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
18-
# proxy "/this-page-has-no-template.html", "/template-file.html", locals: {
19-
# which_fake_page: "Rendering a fake page with a local variable" }
20-
14+
# Disable directory index paths for the 404 page.
2115
page "/404.html", :directory_index => false
2216

2317
# General configuration
2418

25-
19+
# Use Vite for assets.
2620
if build?
21+
# In build mode, force the Vite Ruby integration into production mode so the
22+
# tag helpers know where to look for the built assets.
2723
ENV["RACK_ENV"] = "production"
2824
end
2925
activate :external_pipeline,
3026
name: :vite,
3127
command: build? ? "bundle exec vite build --clobber" : "pnpm exec vite build --watch --mode development",
3228
source: "tmp/vite",
3329
latency: 1
34-
activate :directory_indexes
35-
activate :syntax
36-
30+
# Middleman's file watcher seems to trigger on directory changes when watching
31+
# the vite build directory. So ignore directory changes to avoid it throwing
32+
# errors in local development.
3733
module MiddlemanWatcherViteDirectoryFix
3834
def file_contents_include_binary_bytes?(filename)
3935
if File.directory?(filename)
@@ -45,11 +41,8 @@ def file_contents_include_binary_bytes?(filename)
4541
end
4642
Middleman::Util.singleton_class.send(:prepend, MiddlemanWatcherViteDirectoryFix)
4743

48-
set :css_dir, "assets/stylesheets"
49-
set :js_dir, "assets/javascripts"
50-
set :fonts_dir, "assets/fonts"
51-
set :images_dir, "assets/images"
52-
44+
activate :directory_indexes
45+
activate :syntax
5346

5447
set :markdown_engine, :kramdown
5548
set :markdown, {
@@ -61,9 +54,15 @@ def file_contents_include_binary_bytes?(filename)
6154
# Helpers
6255
###
6356

64-
# Methods defined in the helpers block are available in templates
57+
# Middleman is largely compatible with Padrino helpers, so use the Padrino
58+
# helpers for `vite_*` helpers.
6559
helpers VitePadrino::TagHelpers
60+
61+
# Methods defined in the helpers block are available in templates
6662
helpers do
63+
# Vite's Padrino's helpers just pass `asset_path` a single path, but
64+
# Middleman's `asset_path` expects 2 arguments to give the type and then the
65+
# path. So patch for compatibility.
6766
def asset_path(*args)
6867
if args.length == 1
6968
super(File.extname(args.first).delete_prefix(".").to_sym, args.first)
@@ -86,15 +85,6 @@ def breadcrumbs_trail
8685
end
8786
end
8887

89-
# Build-specific configuration
90-
configure :build do
91-
# Enable cache buster
92-
# activate :asset_hash, :ignore => [
93-
# # Don't cache-bust the Swagger throbber.gif, since it's a hardcoded path.
94-
# %r{throbber.gif},
95-
# ]
96-
end
97-
9888
# Set default API key for local development.
9989
if !ENV["DOCS_API_KEY"] || ENV["DOCS_API_KEY"].to_s.empty?
10090
ENV["DOCS_API_KEY"] = "Rr247zstse9kbndOttzlhKIKnS04mW7UUXIplAqd"

config.ru

Lines changed: 0 additions & 13 deletions
This file was deleted.

config/webpack/development.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

config/webpack/environment.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

config/webpack/production.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

frontend/entrypoints/all.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ import '@fontsource/roboto/700-italic.css';
1313
import '@fontsource/roboto/900.css';
1414
import '@fontsource/roboto/900-italic.css';
1515

16-
import '@/javascripts/_font_awesome_icons';
17-
import '@/lib/auto-icons';
16+
import '@/lib/font_awesome_icons';
17+
import '@/lib/auto_icons';
1818
import '@/lib/toc';

frontend/entrypoints/all.scss

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
// @import "@/stylesheets/_variables";
1+
@import "@/stylesheets/_variables";
22
@import "bootstrap/scss/bootstrap";
33

44
@import "@/nrel-app-template/css/nrel.complete";
55
@import "@/nrel-app-template/css/nrel.application";
66

7-
@import "@/stylesheets/_shared/scaffolding";
8-
@import "@/stylesheets/_shared/popup";
9-
@import "@/stylesheets/_shared/syntax";
10-
@import "@/stylesheets/_shared/docs";
7+
@import "@/stylesheets/_base";
8+
@import "@/stylesheets/_docs";
9+
@import "@/stylesheets/_forms";
1110
@import "@/stylesheets/_swagger_overrides";
12-
13-
// @import "@/stylesheets/_api_umbrella";
14-
@import "@/stylesheets/_nrel/developer";
11+
@import "@/stylesheets/_syntax";
12+
@import "@/stylesheets/_type";

0 commit comments

Comments
 (0)