apal21 / nextjs-progressbar

A simple Next.js progressbar component using NProgress.

Home Page:https://www.npmjs.com/package/nextjs-progressbar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

export css file rather than injecting style tag

hexiro opened this issue · comments

Would it be possible to do what some other libraries do (namely, react-tippy) and export a css file rather than injecting a script tag? This way next can handle the styles, minify and bundle them with the other styles.

For backwards compatibility, you could have a prop called injectStyles and have it default to true. If you'd like

Lmk what you think :)

Reference (react-tippy):
First, you need import css

import 'react-tippy/dist/tippy.css'

Edit: After revisiting, I see that the reason this is probably done is because color and height are injected into the css from the params passed by the user. I'm not against this, but I think that the style tag should atleast be minified.

background: ${color};

This would also make the W3C validator happy :)