admin管理员组

文章数量:1307769

I'm trying to set up a gruntfile that utilizes requirejs and almond. The docs suggest it should be really easy, and following their lead, I tried:

requirejs: {
  pile: {
    options: {
      baseUrl: "tmp",
      mainConfigFile: "tmp/main.js",
      name: "../bower_ponents/almond/almond",
      out: "tmp/<%= pkg.name %>.js"
    }
  }
}

Unfortunately, this approach piles almond.js rather than my actual source. Am I getting something wrong? How do I automate almond along with requirejs?

I'm trying to set up a gruntfile that utilizes requirejs and almond. The docs suggest it should be really easy, and following their lead, I tried:

requirejs: {
  pile: {
    options: {
      baseUrl: "tmp",
      mainConfigFile: "tmp/main.js",
      name: "../bower_ponents/almond/almond",
      out: "tmp/<%= pkg.name %>.js"
    }
  }
}

Unfortunately, this approach piles almond.js rather than my actual source. Am I getting something wrong? How do I automate almond along with requirejs?

Share Improve this question asked Feb 20, 2014 at 0:46 nullnullnullnullnullnull 8,18912 gold badges59 silver badges108 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

The trick is to use include:

requirejs: {
  pile: {
    options: {
      baseUrl: "tmp",
      mainConfigFile: "tmp/main.js",
      include: "main",
      name: "../bower_ponents/almond/almond",
      out: "tmp/<%= pkg.name %>.js"
    }
  }
}

Where main is the require.js file you would typically call like so:

<script data-main="scripts/main" src="scripts/require.js"></script>

本文标签: javascriptUsing almond with gruntcontribrequirejsStack Overflow