Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run grunt 0.4.* without grunt-cli

I wonder if it's possible to run grunt 0.4.* without having installed grunt-cli.

I understand that grunt-cli looks for the version of grunt installed in node-modules in my project directory in order to run that version of grunt but...is it possible to run grunt without having grunt-cli installed? How?

Thanks in advance!

like image 559
cromandini Avatar asked Feb 15 '13 17:02

cromandini


People also ask

How do I install a specific version of grunt?

Installing a specific version If you need a specific version of Grunt or a Grunt plugin, run npm install grunt@VERSION --save-dev where VERSION is the version you need. This will install the specified version, adding it to your package. json devDependencies. Note that a tilde version range will be used in your package.

How do I run local grunt?

Installing grunt-cli locally If you prefer the idiomatic Node. js method to get started with a project ( npm install && npm test ) then install grunt-cli locally with npm install grunt-cli --save-dev. Then add a script to your package. json to run the associated grunt command: "scripts": { "test": "grunt test" } .


1 Answers

The grunt-cli is a very small amount of code. If I was you I would look through it in the GitHub repository. That way you will learn what it does, and it's very easy to do the same.

I have had luck with running it with no grunt-cli. You can do it with the following command:

node -e "require('grunt').cli()"

If you want to specify tasks you can do it like this:

node -e "var g = require('grunt'); g.cli.tasks = ['default']; g.cli()"
like image 68
Allan Kimmer Jensen Avatar answered Oct 02 '22 02:10

Allan Kimmer Jensen