Need help with NPM

I'm working on https://renalmeals.com. I used Google Chrome audit on it. One of the things it recommends is:
"For stylesheets, consider splitting up your styles into different files, organized by media query, and then adding a media attribute to each stylesheet link. When loading a page, the browser only blocks the first paint to retrieve the stylesheets that match the user's device. See Render-Blocking CSS to learn more. Build tools like critical can help you extract and inline critical CSS."

I'm pretty new at npm. No, I'm VERY new at NPM. I managed to install it using $ npm i -D critical@latest. Now I want to do this, below.  And I'm stumped. Can someone give me more specific instructions? Thanks!

Generate and inline critical-path CSS
Basic usage:

critical.generate({
  inline: true,
  base: 'test/',
  src: 'index.html',
  target: 'index-critical.html',
  width: 1300,
  height: 900,
});
Melody ScottAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CDRetiredCommented:
npm is a package management system that has zip to do with creating a critical path for css.
try this online tool https://jonassebastianohlsson.com/criticalpathcssgenerator/
Julian HansenCommented:
Take a look at this link
https://www.npmjs.com/package/critical#cli

You can do this with the CLI

cat test/fixture/index.html | critical --base test/fixture --inline > index.critical.html

Open in new window

The JSON config file you created above should be in the same folder - that is where you tell critical how to evaluate the page you are giving it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
I'm pretty new at npm. No, I'm VERY new at NPM. I managed to install it using
Just to clarify some points
NPM - Node Package Manager - is a tool that comes with Node.js - it is used for adding packages to your dev environment. It does not play a role in the critical operation other than to do the installation.
After that it is up to critical to do the rest.

Just clearing this up as your question talks about doing something with NPM and you not knowing about NPM - NPM is just an installation tool for maintaining packages on your system.
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Melody ScottAuthor Commented:
Ah.. thanks!! WIll look at it tomorrow, thanks for clearing that up!!
Melody ScottAuthor Commented:
Thanks for the lesson!
Melody ScottAuthor Commented:
I made a change to the solution, as Julian answered my question more directly and fully. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.