nuejs / nue

The Design Engineering Framework for the Web
https://nuejs.org
MIT License
6.11k stars 179 forks source link

Disabling `inline_css` in site.yaml crashes #345

Closed goblinfactory closed 1 month ago

goblinfactory commented 1 month ago

Describe the Bug

Disabling inline_css in site.yaml crashes

Environment

Minimal Reproduction

  1. Follow getting started and create the starter blog
  2. Edit site.yaml and change inline_css: true to inline_css: false
  3. Restart nue
  4. open home page, observe error (shown below)
  5. edit site.yaml and restore inline_css:true
  6. re-open homepage; observe error goes away

Logs & Additional Context

nue

✓ Nue 1.0.0-beta.1 • Bun 1.1.27 
✓ Serving site from .dist/dev
✓ http://localhost:8083/ 
65 |     const css = inline_css.map(el => el.css).join('')
66 |     head.push(elem('style', css))
67 | 
68 |   // dev mode: keep path info for hot-reloading
69 |   } else {
70 |     inline_css.forEach(el => head.push(elem('style', { href: base + el.path }, el.css)))
                    ^
TypeError: inline_css.forEach is not a function. (In 'inline_css.forEach((el) => head.push(elem("style", { href: base + el.path }, el.css)))', 'inline_css.forEach' is undefined)
      at renderHead (/Users/alanhemmings/.bun/install/global/node_modules/nuekit/src/layout/head.js:70:16)
      at renderPage (/Users/alanhemmings/.bun/install/global/node_modules/nuekit/src/layout/page-layout.js:129:11)
      at /Users/alanhemmings/.bun/install/global/node_modules/nuekit/src/nuekit.js:116:22
nobkd commented 1 month ago

Thanks for the report.

For the time being, instead of setting to inline_css: false you'll have to remove the line from site.yaml, if you want to disable it. (This of course doesn't work, if you want to have it enabled globally and disabled for only a few pages)