Home › Forums › JavaScript › I need help configuring Grunt.js
- This topic is empty.
-
AuthorPosts
-
August 18, 2014 at 1:19 pm #179582nixnerdParticipant
So, I’ve installed the Grunt CLI via npm. But it looks like I need to install an actual version of the taskrunner? What version should I install? The git version?
Please tell me what you use.
August 18, 2014 at 1:21 pm #179584nixnerdParticipantI’m seeing Grunt 0.4 might be the ticket.
August 18, 2014 at 3:05 pm #179639JacobPetersParticipantOnce you get everything working, I highly recommend moving your plugin configs to separate files for each plugin. at least for me, it makes it easier to find configs.
I store them in yaml, so I can comment in them. Json doesn’t allow comments.
Here is an example of a small config setup.
EDIT: I’m moving the example to gist because I can’t get the code blocks to work.
EDIT 2: Here is a link to the gist https://gist.github.com/jacobcpeters/bf4f6575731dcbb05be9
August 18, 2014 at 3:17 pm #179646nixnerdParticipantDude… I’m a little confused on where npm packages exist once they’re installed. I remember working through it with Ghost but now… I forgot. I installed some stuff via npm and it just added a shit ton of directories to the directory I just happened to be in. So… I’m assuming I need to manually configure that somehow or be in the right directory… which, I don’t know where that would be.
August 18, 2014 at 3:54 pm #179685JacobPetersParticipantIt grabs the npm packages specific to the project. That way you can have an old project that still runs correctly even if you have new projects with updated tools. Just make sure to run it in the base directory of your project.
August 18, 2014 at 3:58 pm #179687AlenParticipantJoe, it reads the package.json file and downloads node_modules. Just add node_modules to your gitignore file and you’re good to go.
And yes, each project will have it’s own dependencies. It’s own node_modules folder.
August 18, 2014 at 3:58 pm #179688nixnerdParticipantOh shit… that’s right. I remember reading about that.
My package management is a bit messed up at the moment. I have 3-5 different package managers and I forget how they all work. I wish Pacman had that feature.
So… I’ll have to install the correct packages for each project? Is that how npm rolls? I guess I could make it part of my build script.
August 18, 2014 at 4:04 pm #179690AlenParticipantSo… I’ll have to install the correct packages for each project?
Yes. See:
{ "devDependencies": { "gulp": "3.8.6", "gulp-autoprefixer": "0.0.8", "gulp-concat": "2.3.3", "gulp-rename": "1.2.0", "gulp-ruby-sass": "0.6.0", "gulp-uglify": "0.3.1" } }
This is my package.json file for Gulp. It resides in the root of my project. When I clone it to my machine, I cd into the cloned folder and run
npm install
this will download all specified modules in my package.json file. Then I just rungulp
and it starts my build.August 18, 2014 at 4:07 pm #179693nixnerdParticipantAlright. I’m going to mess around with this some more tonight. Thanks gents.
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.