user3713675
user3713675

Reputation: 5

grunt requirejs compile multi-mainConfigFile

I have issues with compile multi-mainConfigFile in grunt-contrib-requirejs.

I don't know how to configure the gruntfile.js,although read page 'Grunt & requirejs optimizer for a multi app project'.

. ├── index.js ├── main.js └── module ├── common.js └── dao.js

```
requirejs: {

compile: {

   options: {

     name : "main",
                optimize: "uglify",
                mainConfigFile: "./assets/js/main.js",
                out: "./static/js/app.min.js"
            }
        }
    }

```

That is all .

I want to compile index.js and main.js .

Please help me.

Upvotes: 0

Views: 137

Answers (1)

David Lee
David Lee

Reputation: 171

I think the article you read is saying make another sibling block to compile with the other configuration.

e.g.

requirejs: {
  main: {
    options: {
      // first config
    }
  },
  index: {
    options: {
      // second config
    }
  }
}

On a side note, if you want shared dependencies across the two apps and one config file, there's a concept called requirejs modules.

Upvotes: 0

Related Questions