Skip to content

Avoid incorrect pattern matching during minification

Sarah German requested to merge 1236-minify-flags into main

What does this MR do and why

This issue came up because our minification script's match regex was not strict enough, and the filename of the SCSS page (scss.html) caused it to be minified as CSS (where all-lowercase is good!) instead of HTML (where all-lowercase might be weird).

Nice explanation from the minify maintainer here: https://github.com/tdewolff/minify/issues/522

Screenshots

Before After
image image

How to test

  1. Visit the SCSS style guide page in the review app
  2. Verify that this page is not entirely lowercase
  3. Verify by looking at pipeline output that assets have still been minified

Or test locally:

  1. Turn on nanoc's web server (bundle exec nanoc view) and load the SCSS page locally. It should have correct letter-casing.
  2. On the main branch, run the minify script: cd public && ../scripts/minify-assets.sh ./ ./
  3. Note that the SCSS page is now lowercase.
  4. Remove the /public directory and recompile it (bundle exec nanoc compile).
  5. Check out this branch (1236-minify-flags) and run the minify script again: cd public && ../scripts/minify-assets.sh ./ ./
  6. Note that the SCSS page has not been minified as CSS (it will have correct letter casing).
Edited by Marcel Amirault

Merge request reports