Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: enables CSS minification via environment variable (#172)
Setting `CLAYCLI_COMPILE_MINIFED` (or any of the variants) did *not* minify CSS or Fonts. This was due to our use of a package called `gulp-if`, which has a usage like this: ```js gulpIf(condition, trueChild, falseChild, minmatchOptions); ``` Where `condition` is expected to either be: 1. A `boolean`. 2. A `function` that will return a `boolean`. When setting `CLAYCLI_COMPILE_MINIFIED` from an environment variable we end up with a `string` value for `minify`, which causes `gulpIf` to evaluate to `false`, skipping minification. This commit simply casts `minify` to a `bool` when calling `gulpIf`. A more robust approach would be to fix typing across the board for environment variable defaults, providing some sort of `strToBool` method to cast `['1', 't', 'true', 'y', 'yes']` to `true` and everything else to `false`. Taking the more robust approach would require a larger refactor and is a good follow-up candidate for this bug fix. :warning: Note: There is not an existing test suite to validate this change, all tests were performed manually by running `clay compile` on an existing `clay` project with `export CLAYCLI_COMPILE_MINIFIED=true` before the commit & then checking the format of the CSS output files (they were not minified). After adding the commit, re-running with `CLAYCLI_COMPILE_MINIFIED=true` resulted in minified CSS output.
- Loading branch information