Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript I need help configuring Grunt.js

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #179582
    nixnerd
    Participant

    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.

    #179584
    nixnerd
    Participant

    I’m seeing Grunt 0.4 might be the ticket.

    #179639
    JacobPeters
    Participant

    Once 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

    #179646
    nixnerd
    Participant

    Dude… 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.

    #179685
    JacobPeters
    Participant

    It 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.

    #179687
    Alen
    Participant

    Joe, 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.

    #179688
    nixnerd
    Participant

    Oh 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.

    #179690
    Alen
    Participant

    So… 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.

    #179693
    nixnerd
    Participant

    Alright. I’m going to mess around with this some more tonight. Thanks gents.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.