Running Grunt with options

Hi,

I need to run a Grunt task with different options via View -> Tools Window -> Grunt. So far I can run the default task but did not work out so far how to provide options. On commandline I am calling grunt --scope=min Is it possible to also provide such option when running the default task from PHPStorm´s Grunt Tool Window? How? I did not suceed with Node options. If yes which is the exact syntax to use?

5 comments
Comment actions Permalink

What options would you like to pass namely?
To specify custom CMD options (retrieved via grunt.option()) passed to Grunt task, use Tasks field, like: 'print --echo=Hello', where:

registerTask('opt', 'Test options.', function(n) {
  var echo = grunt.option('echo');
  console.log(echo);
});
grunt.registerTask('print', ['opt']);
0
Comment actions Permalink

Does not work for me. The tasks field does not accept an option string. Cold you please send a screenshot?
And yes. I want to pass the option --scope=min which is then used via grunt.option. This works from the command line but not if called from the Grunt tasks window in PHPStorm



Attachment(s):
s1.jpg
0
Comment actions Permalink

Not sure what you mean dsaying that it doesn't accept it - it's just a simple text field that accepts any input.
Heere is a screenshot:
grunt.png

0
Comment actions Permalink

Now it works for me. The problem was that if y
ou right click on the default task in the Grunt pane and choose "Edit default setting" always autmoatically a new run/debug configuration is created and if you don´t look very close you don´t recognize it and it seems that the option is not save. Also you can´t run the configuration on right click from there. You need to do it via the dropwdown in the navigation bar....Maybe something to improve  

0
Comment actions Permalink

The problem was that if you right click on the default task in the Grunt pane and choose "Edit default setting" always autmoatically a new run/debug configuration is created and if you don´t look very close you don´t recognize it and it seems that the option is not save. Also you can´t run the configuration on right click from there

A run configuration with "Tasks" value that differs from a clicked task name can't be reused to run/edit the clicked task.... So this is by design

0

Please sign in to leave a comment.