Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper way to remove components/tasks from yeoman/grunt?

I'm new to the Yeoman/Grunt/Bower stack and I'm unsure if there is a proper way to remove a component/task from my project. I don't use CoffeeScript (which was packaged with the Yeoman generator) and it feels like I should be using a Grunt task or Bower command to remove the files/requirements/config/etc.

However, I can't find anything mentioning how to do this. Am I missing something or should I just remove the components by hand?

like image 635
Indolering Avatar asked Nov 11 '13 19:11

Indolering


2 Answers

I don't believe there is an automated way of doing this; save for https://github.com/indieisaconcept/grunt-plugin but that's for the old release (0.3.9) of Grunt.

For Grunt tasks, simply remove the line in devDependencies in package.json and then remove the relevant section in grunt.initConfig and you will have uninstalled the plugin. Depending on how your Gruntfile looks, you may have to remove the grunt.loadNpmTasks(<package>) section for the relevant plugin. Then remove the directory in node_modules (or run npm uninstall <package>). Simple really.

Bower is even easier; remove the relevant line in bower.json and delete the directory it was installed (the default is bower_components).

Hope this helps. :)

like image 137
Ben Avatar answered Oct 22 '22 23:10

Ben


You can remove a Grunt task by running the following command:

npm uninstall grunt-task-name --save

...where grunt-task-name is the name of the task you want to remove. The --save flag tells npm to update your package.json file as well as deleting the relevant package from your node_modules directory. (nb. if the task is listed under devDependencies - as it might well be - you might need to use the --save-dev flag instead).

For Bower the process is the same, only with bower uninstall instead of npm uninstall (as mentioned in Michael Onikienko's answer)

like image 4
Nick F Avatar answered Oct 23 '22 00:10

Nick F