Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8855075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:02:37+00:00 2026-06-14T14:02:37+00:00

How do people handle common configuration options in Grunt for multiple projects. The projects

  • 0

How do people handle common configuration options in Grunt for multiple projects. The projects would share some common configuration options, e.g. for min, but also have private or custom configuration settings per project, e.g. only one out of three projects requires less or has different options for it.

Is there a way to share this common configuration between the projects, using inheritance or importing an existing file, or does each project have to define all settings?

The projects I’m referring to would reside in a directory hierarchy like

root
    module1
         grunt.js
    module2
         grunt.js
    module3
         grunt.js

Is there some way to provide common configuration settings at the root level?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:02:40+00:00Added an answer on June 14, 2026 at 2:02 pm

    You can easily store configuration in as many external JSON files as you need. grunt.file.readJSON will help you here. For example:

    module.exports = function(grunt) {
    
      var concatConf = grunt.file.readJSON('../concat-common.json'),
          minConf = grunt.file.readJSON('../min-common.json');
    
      // do whatever you want with concatConf and minConf here
      // ...
    
      // Project configuration.
      grunt.initConfig({
        pkg: '<json:grunt-sample.jquery.json>',
        meta: {
          banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
            '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
            '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
            ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
        },
    
        concat: concatConf,
        min: minConf
    
        // ...
      });
    
      // Default task.
      grunt.registerTask('default', 'concat min');
    
    };
    

    Don’t forget that a gruntfile is a regular JavaScript file executed in Node environment and configuration options are regular JavaScript objects 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm interested to know how people handle the following situation. Assume we have a
It's very common to have at least one configuration file in any project. Every
I wonder how people handle nonexhaustive match warnings in the SML/NJ compiler. For example,
People familiar with Homographies will know that you have to normalize it dividing by
people. I have slight problem with GD2 text on image. I have everything working
Some people at the office feel uncomfortable having to disable macro security for outlook
I want to design a new distributed application, but I have a few queries
I would like to have a function called in an onclick handler, within an
I was wondering - how do people handle importing large numbers of commonly used
I am wondering how people handle nested/complex routes for an application when using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.