SFDigitalServices / formio-sfds

The form.io theme for sf.gov
https://formio-sfds.herokuapp.com/
MIT License
15 stars 2 forks source link

Add modern spacing utilities from design system #248

Closed shawnbot closed 1 year ago

shawnbot commented 1 year ago

Until we figure out what's up with the safelist not working in https://github.com/SFDigitalServices/sfgov/pull/1462, we need to add these spacing utilities here to fix existing forms.

This one ended up being way more complicated than I'd hoped. Adding new CSS and then changing the templates fails the build because the snapshots need to be updated. But I couldn't figure out why my snapshots weren't matching in CI until I remembered that the tests run the built JS, so you have to build the JS before updating the snapshots:

npm run build-js
npx jest -u

Of course, this yielded a cryptic error:

> formio-sfds@9.2.7 build-js
> rollup -c

src/standalone.js → dist/formio-sfds.standalone.js...
[!] (plugin postcss) Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
dist/formio-sfds.css
Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
    at readWasm (/Users/shawn.allen/sfds/formio-sfds/node_modules/@csstools/postcss-sass/node_modules/source-map/lib/read-wasm.js:8:13)
    at wasm (/Users/shawn.allen/sfds/formio-sfds/node_modules/@csstools/postcss-sass/node_modules/source-map/lib/wasm.js:25:16)
    at /Users/shawn.allen/sfds/formio-sfds/node_modules/@csstools/postcss-sass/node_modules/source-map/lib/source-map-consumer.js:264:14
    at async Promise.all (index 0)

I fixed this with npm i -D source-map, as suggested in https://github.com/mozilla/source-map/issues/432.

Heads up to @aekong on this too 😄

github-actions[bot] commented 1 year ago

Size Change: +2.66 kB (+3%)

Total Size: 92.5 kB

Filename Size Change
dist/formio-sfds.css 15.1 kB +1.29 kB (+9%) 🔍
dist/formio-sfds.standalone.js 70.8 kB +1.37 kB (+2%)
ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `dist/portal.js` | 6.65 kB |

compressed-size-action