Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task does nothing when loaded with grunt.loadTasks(subDir) #106

Open
alanalvarado opened this issue Jan 9, 2020 · 2 comments
Open

Task does nothing when loaded with grunt.loadTasks(subDir) #106

alanalvarado opened this issue Jan 9, 2020 · 2 comments

Comments

@alanalvarado
Copy link

Hello, I am using grunt 1.04, running on osx Mojave 10.14.6. When I load clean task with grunt.loadTasks(subDir) and run the next command:

grunt clean

it just freezes the command line, i have to ctrl c to continue

If I uncomment the line loadNpmTasks and comment registertask then it works.

configuration content is as follows:

gruntfile.js

module.exports = function(grunt) {
	require('jit-grunt')(grunt);

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		path: grunt.file.readJSON('routes.json'),
	});

	grunt.loadTasks('grunt/tasks');

	// Log our current config
	console.log(grunt.config());

        // grunt.loadNpmTasks('grunt-contrib-clean');
		
	grunt.registerTask('clean', ['clean']);
	
};

clean.js

module.exports = function(grunt) {
	grunt.config('clean', {
		styles: ['**/*.css']
	});
};
@alanalvarado
Copy link
Author

In fact I just checked with my old branch where all grunt configuration was in only one file, grunt-contrib-clean does the same, the problem appears when I do grunt.registerTask('clean', ['clean']

@alanalvarado
Copy link
Author

Ok for anyone out there trying this, the problem seems to be related to the next post.
gruntjs/grunt#1260

Simply comment loadNpmTasks and use registerTask with another name, clean is reserved.

gruntfile.js

module.exports = function(grunt) {
	require('jit-grunt')(grunt);

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		path: grunt.file.readJSON('routes.json'),
	});

	grunt.loadTasks('grunt/tasks');

	// Log our current config
	console.log(grunt.config());

        // grunt.loadNpmTasks('grunt-contrib-clean');
		
	grunt.registerTask('remove', ['clean']);
	
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant