Repository: ProjectEvergreen/greenwood (js)

Issue:
`<style>` tags in the `<body>` are not getting optimized
Contrary to #581, it looks like a `<style>` in the `<body>` are not getting optimized.

For example
```html
<body>
  <style>
    * {
      color: red;
      font-size: blue;
    }
  </style>
</body>
```

Comes out _without_ any minification applied
![Image](https://user-images.githubusercontent.com/895923/205793094-8bb527d1-9792-414b-8a59-bf0890ba4fac.png)

----

Answer is pretty simple actually, [it was never enabled](https://github.com/ProjectEvergreen/greenwood/blob/v0.27.0/packages/cli/src/lifecycles/prerender.js#L51).  🤦 

Could have sworn I had a test for this, so will definitely want to write one now.  😬 

Pull request description:
Bug/issue 1022 style tags in body not optimizing
<!--
## Submitting a Pull Request
We love contributions and appreciate any help you can offer!
-->

## Related Issue
resolves #1022 

## Summary of Changes
1. Make sure `<style>` tags in the `<body>` also get optimized
1. Make sure specs don't trim whitespace

Patch:
diff --git a/packages/cli/src/lifecycles/prerender.js b/packages/cli/src/lifecycles/prerender.js
index 6ba75233..65437e77 100644
--- a/packages/cli/src/lifecycles/prerender.js
+++ b/packages/cli/src/lifecycles/prerender.js
@@ -48,7 +48,7 @@ function trackResourcesForRoute(html, compilation, route) {
       }
     });
 
-  const styles = root.querySelectorAll('head style')
+  const styles = root.querySelectorAll('style')
     .filter(style => !(/\$/).test(style.rawText) && !(/<!-- Shady DOM styles for -->/).test(style.rawText)) // filter out Shady DOM <style> tags that happen when using puppeteer
     .map(style => modelResource(context, 'style', null, style.rawText, null, style.getAttribute('data-gwd-opt')));
 


Test patch:
diff --git a/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js b/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js
index 713bde99..580d8131 100644
--- a/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js
+++ b/packages/cli/test/cases/build.config.optimization-default/build.config-optimization-default.spec.js
@@ -111,6 +111,15 @@ describe('Build Greenwood With: ', function() {
           expect(customCss).to.be.equal(expectedCss);
         });
       });
+
+      describe('<style> tag in the `<body>` of the page', function() {
+        it('should have the expected contents of the <style> tag', async function() {
+          const styleTags = Array.from(dom.window.document.querySelectorAll('body style'));
+
+          expect(styleTags.length).to.equal(1);
+          expect(styleTags[0].textContent.replace(/\n/g, '')).to.equal('*{color:red;font-size:blue;}');
+        });
+      });
     });
   });
 
diff --git a/packages/cli/test/cases/build.config.optimization-default/src/pages/index.html b/packages/cli/test/cases/build.config.optimization-default/src/pages/index.html
index 8944d68b..a938c51e 100644
--- a/packages/cli/test/cases/build.config.optimization-default/src/pages/index.html
+++ b/packages/cli/test/cases/build.config.optimization-default/src/pages/index.html
@@ -11,6 +11,12 @@
     <div class="gwd-content-outlet">
       <div>
         <app-header></app-header>
+        <style>        
+          * {
+            color: red;
+            font-size: blue;
+          }
+        </style>
       </div>
     </div>
 
diff --git a/packages/cli/test/cases/build.default.workspace-javascript-css/build.default.workspace-javascript-css.spec.js b/packages/cli/test/cases/build.default.workspace-javascript-css/build.default.workspace-javascript-css.spec.js
index f1b81475..21f88e8c 100644
--- a/packages/cli/test/cases/build.default.workspace-javascript-css/build.default.workspace-javascript-css.spec.js
+++ b/packages/cli/test/cases/build.default.workspace-javascript-css/build.default.workspace-javascript-css.spec.js
@@ -145,13 +145,13 @@ describe('Build Greenwood With: ', function() {
       it('should have the expected output from the first inline <style> tag in index.html', async function() {
         const styleTags = dom.window.document.querySelectorAll('head > style');
 
-        expect(styleTags[0].textContent.replace(/\n/g, '').trim()).to.equal('p.output-style{color:green}');
+        expect(styleTags[0].textContent.replace(/\n/g, '')).to.equal('p.output-style{color:green}');
       });
 
       it('should have the expected output from the second inline <style> tag in index.html', async function() {
         const styleTags = dom.window.document.querySelectorAll('head > style');
 
-        expect(styleTags[1].textContent.replace(/\n/g, '').replace(/ /g, '')).to.equal('span.output-style{color:red}');
+        expect(styleTags[1].textContent.replace(/\n/g, '')).to.equal('span.output-style{color:red}');
       });
 
       it('should have the color style for the output element', function() {
@@ -172,7 +172,7 @@ describe('Build Greenwood With: ', function() {
       it('should have the expected output from the first inline <style> tag in index.html in the <body>', async function() {
         const styleTags = dom.window.document.querySelectorAll('body > style');
 
-        expect(styleTags[0].textContent.replace(/\n/g, '').replace(/ /g, '')).to.contain('h1.popup{color:red;}');
+        expect(styleTags[0].textContent.replace(/\n/g, '')).to.contain('h1.popup{color:red}');
       });
     });