I have installed the less compiler ( lessc
) and stylelint ( stylelint
).
I don't wish these to be installed globally, so they are in package.json
's dev dependencies section. I am only able to run them via npm run <some name here>
. I'd like to be able to manually run them via simply typing lessc
as though it was globally installed.
"scripts": {
"lint": "stylelint ./src/**/*.less",
"compile": "lessc --help"
},
"devDependencies": {
"less": "^2.7.3",
"stylelint": "^8.3.1"
}
Having to tweak the compile
npm script everytime is not ideal, which is why I'd like the option of experimenting from the command line.
I tried npm lessc --my-flags-here
but this is not a valid command. Is what I'd like to do possible, or will I have to stick to editing package.json every time?
Since you installed them locally they aren't available globally, so in order to access them with using npm run
you'd need to reference the folder in which they are contained in the current project's directory.
Something like this would work: node_modules/.bin/lessc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.