rails_template_18f 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69b1bf665be20b3234b5a6cc358a35167cf3ab4dc7833ba1f8a3615970f2a617
4
- data.tar.gz: ec93203edd447a12699c94d57583b7971f846e70f415ad91915860386f83e862
3
+ metadata.gz: d71812f11d19dc0ed9960407de8d0b3c0755c0d6bb2ba64981af55f0add88657
4
+ data.tar.gz: 63d920adcc4e1e8acd83805d0edcaf5235f75150226dcd1ee8dcbef303407ba6
5
5
  SHA512:
6
- metadata.gz: dec9d9bcd8c8111fbcfc826d995fd8197751e93c0c4463fd0d321d3a71b71a920f39340b60df4011cf0ab3ccbce9a6ec71258044cfc11bdae29f271fcde4d978
7
- data.tar.gz: 22e0ce9181cef72c2081326175b314e865f752422e9d72a54e74f01fca39e23c70b23659ba5c7372ec4dc141a826f48a691d0f68690ba810ce7fe9e6eab6269b
6
+ metadata.gz: bca37870efffd0200b5fbf1b9491a1497cd1cdae7423d93f9c0eda1ff2cde4779932ea8f23be29f632e0310483c31724273d64d36a78d94e67a94c1cd903eb1a
7
+ data.tar.gz: 6d09c8fc4870c7ca1851fdd4c439ec1b6dd73d8e9551ca2b3d0be2d5da1a2f28e0cd9655ba219f25c2674face10ea0b8d5eeaadba6fd47705b04d516ac777d67
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2022-06-07
4
+
5
+ - include USWDS 3.0 for new apps
6
+ - use postcss-minify instead of the sass gem for CSS minimization
7
+
3
8
  ## [0.5.3] - 2022-06-06
4
9
 
5
10
  - check that server started properly before running anything in `bin/with-server`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails_template_18f (0.5.3)
4
+ rails_template_18f (0.6.0)
5
5
  activesupport (~> 7.0.0)
6
6
  colorize (~> 0.8)
7
7
  railties (~> 7.0.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsTemplate18f
4
- VERSION = "0.5.3"
4
+ VERSION = "0.6.0"
5
5
  end
data/template.rb CHANGED
@@ -226,35 +226,33 @@ end
226
226
 
227
227
  # setup USWDS and asset pipeline
228
228
  copy_file "browserslistrc", ".browserslistrc" if webpack?
229
- uncomment_lines "Gemfile", "sassc-rails" # use sassc-rails for asset minification in prod
230
229
  after_bundle do
231
- js_startup = if webpack?
232
- "webpack --config webpack.config.js"
233
- else
234
- "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds"
235
- end
236
- insert_into_file "package.json", <<-EOJSON, before: /^\s+"dependencies"/
237
- "scripts": {
238
- "build": "#{js_startup}",
239
- "build:css": "postcss ./app/assets/stylesheets/application.postcss.css -o ./app/assets/builds/application.css"
240
- },
241
- EOJSON
230
+ run 'npm set-script build:css "postcss ./app/assets/stylesheets/application.postcss.scss -o ./app/assets/builds/application.css"'
242
231
  # include verbose flag for dev postcss output
243
232
  gsub_file "Procfile.dev", "yarn build:css --watch", "yarn build:css --verbose --watch"
244
233
  # Replace postcss-nesting with sass since USWDS uses sass
245
234
  run "yarn remove postcss-nesting"
246
- run "yarn add @csstools/postcss-sass"
247
- run "yarn add postcss-scss"
235
+ run "yarn add @csstools/postcss-sass postcss-scss postcss-minify"
248
236
  insert_into_file "postcss.config.js", " syntax: 'postcss-scss',\n", before: /^\s+plugins/
249
- gsub_file "postcss.config.js", "postcss-nesting", "@csstools/postcss-sass"
250
- run "yarn add uswds"
237
+ insert_into_file "package.json", <<-EOJSON, before: /^\s+\}$/
238
+ },
239
+ "resolutions": {
240
+ "@csstools/postcss-sass/@csstools/sass-import-resolve": "https://github.com/rahearn/sass-import-resolve"
241
+ EOJSON
242
+ gsub_file "postcss.config.js", "postcss-nesting'),", <<~EOJS.strip
243
+ @csstools/postcss-sass')({
244
+ includePaths: ['./node_modules/@uswds/uswds/packages'],
245
+ }),
246
+ EOJS
247
+ insert_into_file "postcss.config.js", " process.env.NODE_ENV === 'production' ? require('postcss-minify') : null,\n", before: /^\s+\],/
248
+ run "yarn add @uswds/uswds"
251
249
  appjs_file = "app/javascript/application.js"
252
- append_to_file appjs_file, "\nimport \"uswds\"\n"
250
+ append_to_file appjs_file, "\nimport \"@uswds/uswds\"\n"
253
251
  if hotwire?
254
252
  append_to_file appjs_file, <<~EOJS
255
253
 
256
254
  // make sure USWDS components are wired to their behavior after a Turbo navigation
257
- import components from "uswds/src/js/components"
255
+ import components from "@uswds/uswds/src/js/components"
258
256
  let initialLoad = true;
259
257
  document.addEventListener("turbo:load", () => {
260
258
  if (initialLoad) {
@@ -272,9 +270,12 @@ after_bundle do
272
270
  end
273
271
  directory "app/assets"
274
272
  append_to_file "app/assets/stylesheets/application.postcss.css", <<~EOCSS
275
- @import "uswds-settings.scss";
276
- @import "../../../node_modules/uswds/dist/scss/uswds.scss";
273
+ @forward "uswds-settings.scss";
274
+ @forward "uswds-components.scss";
277
275
  EOCSS
276
+ inside "app/assets/stylesheets" do
277
+ File.rename("application.postcss.css", "application.postcss.scss")
278
+ end
278
279
  gsub_file "app/views/layouts/application.html.erb", "<html>", '<html lang="<%= I18n.locale %>">'
279
280
  gsub_file "app/views/layouts/application.html.erb", /^\s+<%= yield %>/, <<-EOHTML
280
281
  <%= render "application/usa_banner" %>
@@ -1,5 +1,6 @@
1
1
  // Glue to find USWDS images with the `image_tag` helper
2
2
 
3
- //= link uswds/dist/img/us_flag_small.png
4
- //= link uswds/dist/img/icon-dot-gov.svg
5
- //= link uswds/dist/img/icon-https.svg
3
+ //= link @uswds/uswds/dist/img/us_flag_small.png
4
+ //= link @uswds/uswds/dist/img/icon-dot-gov.svg
5
+ //= link @uswds/uswds/dist/img/icon-https.svg
6
+ //= link @uswds/uswds/dist/img/usa-icons/close.svg
@@ -0,0 +1,7 @@
1
+ @forward "uswds-global";
2
+ @forward "uswds-utilities";
3
+ @forward "uswds-typography";
4
+ @forward "usa-header";
5
+ @forward "usa-banner";
6
+ @forward "usa-section";
7
+ // add additional packages here as you use them
@@ -1,7 +1,10 @@
1
- // Point the asset pipline to the correct locations
2
- $theme-font-path: "uswds/dist/fonts";
3
- $theme-image-path: "uswds/dist/img";
1
+ @use "uswds-core" with (
2
+ // Point the asset pipline to the correct locations
3
+ $theme-font-path: "@uswds/uswds/dist/fonts",
4
+ $theme-image-path: "@uswds/uswds/dist/img",
4
5
 
5
- $theme-show-notifications: false;
6
+ $theme-show-notifications: false,
6
7
 
7
- // Put your USWDS Theme settings here
8
+ // Put your USWDS Theme settings here
9
+
10
+ );
@@ -1,3 +1,3 @@
1
- <div class="font-sans-lg padding-y-4 bg-secondary-darker text-white line-height-1 text-center">
1
+ <div class="font-sans-lg padding-y-4 bg-secondary-darker text-white line-height-heading-1 text-center">
2
2
  <%= t('shared.header.demo_banner') %>
3
- </div>
3
+ </div>
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <nav aria-label="<%= t('shared.header.primary') %>" class="usa-nav">
13
13
  <button class="usa-nav__close">
14
- <%= image_tag "uswds/dist/img/usa-icons/close.svg", role: "img", alt: t('shared.header.close') %>
14
+ <%= image_tag "@uswds/uswds/dist/img/usa-icons/close.svg", role: "img", alt: t('shared.header.close') %>
15
15
  </button>
16
16
  <ul class="usa-nav__primary usa-accordion">
17
17
  <% I18n.available_locales.each do |l| %>
@@ -5,7 +5,7 @@
5
5
  <header class="usa-banner__header">
6
6
  <div class="usa-banner__inner">
7
7
  <div class="grid-col-auto">
8
- <%= image_tag "uswds/dist/img/us_flag_small.png", alt: t('shared.banner.us_flag'), class: "usa-banner__header-flag" %>
8
+ <%= image_tag "@uswds/uswds/dist/img/us_flag_small.png", alt: t('shared.banner.us_flag'), class: "usa-banner__header-flag" %>
9
9
  </div>
10
10
  <div class="grid-col-fill tablet:grid-col-auto">
11
11
  <p class="usa-banner__header-text">
@@ -30,14 +30,14 @@
30
30
  <% end %>
31
31
  <div class="grid-row grid-gap-lg">
32
32
  <div class="usa-banner__guidance tablet:grid-col-6">
33
- <%= image_tag "uswds/dist/img/icon-dot-gov.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
33
+ <%= image_tag "@uswds/uswds/dist/img/icon-dot-gov.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
34
34
  <div class="usa-media-block__body">
35
35
  <strong><%= t('shared.banner.gov_heading') %></strong>
36
36
  <br> <%= t('shared.banner.gov_description_html') %>
37
37
  </div>
38
38
  </div>
39
39
  <div class="usa-banner__guidance tablet:grid-col-6">
40
- <%= image_tag "uswds/dist/img/icon-https.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
40
+ <%= image_tag "@uswds/uswds/dist/img/icon-https.svg", role: "img", "aria-hidden": true, class: "usa-banner__icon usa-media-block__img" %>
41
41
  <div class="usa-media-block__body">
42
42
  <p>
43
43
  <strong><%= t('shared.banner.secure_heading') %></strong>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_template_18f
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-06 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -214,6 +214,7 @@ files:
214
214
  - templates/Brewfile
215
215
  - templates/README.md.tt
216
216
  - templates/app/assets/images/uswds.js
217
+ - templates/app/assets/stylesheets/uswds-components.scss
217
218
  - templates/app/assets/stylesheets/uswds-settings.scss
218
219
  - templates/app/views/application/_banner_lock_icon.html.erb
219
220
  - templates/app/views/application/_demo_site_banner.html.erb