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?
1 Answer
Reset to default 11The 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
版权声明:本文标题:javascript - Using almond with grunt-contrib-requirejs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741847925a2400892.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论