I want to create a file in given folder from terminal using npm script. I know it works like adding custom script in scripts object of package.json file like:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon app.js",
"addstyle": "touch ./css/stylesheet.css"
},
and then run npm run addstyle from terminal.
But what if I want to pass custom name for my stylesheet from terminal?
I got few options like adding $variable in script:
"scripts": {
...
"addstyle": "touch ./css/$filename.css"
},
and then add filename before the command i.e. filename=homepage npm run addstyle
Is there anyway, I can append a parameter in the end with - or -- like:
npm run addstyle --filename=homepage
. OR
npm run addstyle -filename homepage
Run this command and assign the $FILE_NAME