Reputation: 230
I recently created a custom task, doing the following
Unfortunately Grunt is giving me the error - "No "mytask" targets found", whenever I call the task.
This is the part of my Gruntfile.js --> init section:
my-task: {
all: {
options: {
input_folder: 'input',
output_file: 'result/result.xml'
}
}
},
Below I load the tasks:
grunt.loadTasks('./custom-tasks')
Then I register my-task:
grunt.registerTask('test', ['my-task']);
Can someone please help me, I'm new to Grunt and would like to have my custom task working. But all I get is the No-target-error.
Thank you!!!
Upvotes: 0
Views: 420
Reputation: 230
I solved the issue by rebuilding the script from scratch. Got a 'typo', so the task wasnÄt able to be executed. Unfortunately grunt told that there were issues with the targets, what wasn't exactly the case.
Thanks anyway!
Upvotes: 1
Reputation: 16066
try something like this:
'use strict';
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
},
my-task: {
all: {
options: {
input_folder: 'input',
output_file: 'result/result.xml'
}
}
});
require('load-grunt-tasks')(grunt);
// Making grunt default to force in order not to break the project.
grunt.option('force', true);
grunt.registerTask('test', ['my-task']);
Upvotes: 0