I have never used npm
before so I may not be asking the question how it should be asked but I could not find this information anywhere. Let's say I am interested in using this module. The author asks me to install the module which I do by typing the following in command line.
npm install --save critical
I am lost after that. The author writes a bunch of lines but I have no idea where to put them.
var critical = require('critical');
and
critical.generate({
inline: true,
base: 'test/',
src: 'index.html',
dest: 'index-critical.html',
width: 1300,
height: 900
});
Where do I put this code and how do I run it. I tried creating a file called criticaldemo.js
and put all this code there but running it through command line did nothing. TO run it through command line I used the following command:
$ criticalfile.js
Can anyone please help me understand how to use npm modules?