Closed kaanra closed 9 years ago
Hi @Moondrop,
above example will create two tasks watch:scripts
and jshint:scripts
, then if it is needed you can create alias scripts
which will execute both tasks. For example:
grunt/aliases.json
{
"scripts": [
"jshint:scripts",
"watch:scripts"
]
}
Hi @SolomoN-ua, thanks for the reply! I was able to get the watch:scripts
working with config grouping, but for some reason when I try jshint:scripts
I get the error:
Running "jshint:scripts" (jshint) task
Verifying property jshint.scripts exists in config...ERROR
>> Unable to process task.
Warning: Required config property "jshint.scripts" missing. Use --force to continue.
Aborted due to warnings.
Here's my folder setup:
- Gruntfile.js
- grunt/
- aliases.js
- config/
- scripts-task.js
Hi @Moondrop, can you show your Gruntfile.js
?
Hi @SolomoN-ua, here's how my Gruntfile.js looks:
module.exports = function(grunt) {
/**
* Load Grunt Config
* Includes load-grunt-tasks and jit grunt
*/
require('load-grunt-config')(grunt);
/**
* Time Grunt
* Find out how long each task takes
*/
require('time-grunt')(grunt);
};
I was also mistaken about watch:scripts
working. It was only working because I had an existing grunt/watch.js
file. With that removed watch:scripts
no longer works.
@Moondrop, first rename scripts-task.js
to scripts-tasks.js
and then try to move all config files from grunt/config/*
subfolder to grunt/*
folder directly.
Hi @SolomoN-ua, thanks a ton for your help. After moving scripts-tasks.js
out of my config
folder I was able to get everything working. I thought the -tasks.js
file had to be in a config
folder since the documentation example shows /config/scripts-tasks.yaml
.
On a side note, I also figured out why I was having so much trouble getting jshint:scripts
to work. It seems there is an issue with using jshint: { files: ['*.js'] }
(https://github.com/tschaub/grunt-newer/issues/54). It kept giving me the error:
Running "jshint:files" (jshint) task
Warning: Cannot use 'in' operator to search for 'src' in Gruntfile.js Use --force to continue.
I had to use jshint: { src: ['*.js'] }
instead in order to get jshint:scripts
to work.
Hello, I'm bit of a grunt newbie and I'm not quite understanding how the config grouping feature works.
I've seen the an example in another topic (https://github.com/firstandthird/load-grunt-config/issues/99), and recreated a similar setup:
grunt/scripts-tasks.js
But how do you run the scripts-tasks.js? Do you make an alias for them (then you type something like
grunt scripts
into the terminal)?