最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using almond with grunt-contrib-requirejs - Stack Overflow

programmeradmin0浏览0评论

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>
发布评论

评论列表(0)

  1. 暂无评论