5

首先,我通过 bower 包含了 stripe.js 文件:

bower install --save stripe.js=https://js.stripe.com/v2/

它创建了“vendor/stripe/index”(注意不是index.js,而是 index)。然后我将它添加到我的花椰菜文件中:

app.import('vendor/stripe/index')

这让我遇到了这个错误:

You must pass a file to `app.import`. For directories specify them to the constructor under the `trees` option.Error: You must pass a file to `app.import`. For directories specify them to the constructor under the `trees` option.
  at EmberApp.import (/home/jim/Desktop/TaskVelocity/task-velocity/node_modules/ember-cli/lib/broccoli/ember-app.js:521:11)
  at Object.<anonymous> (/home/jim/Desktop/TaskVelocity/task-velocity/Brocfile.js:9:11)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)

我缺少什么让这个工作?

尝试了用户的建议,并收到此错误:

Path or pattern "vendor/stripe/stripe.js" did not match any files Error: Path or pattern "vendor/stripe/stripe.js" did not match any files 
at Object.multiGlob   (/home/jim/Desktop/TaskVelocity/web/node_modules/ember-cli/node_modules/broccoli‌​-concat/node_modules/broccoli-kitchen-sink-helpers/index.js:221:13) – 
4

3 回答 3

4

就个人而言,我手动创建了所有内容,因为 /v2/index.js 真的把事情搞砸了。不理想,我知道,但 Stripe 现在在我的应用程序中运行良好。

在我的 Brocfile.js 中:

   app.import('vendor/stripe/stripe.js');

在我的应用程序的文件结构中,该文件位于:

   [appname]/vendor/stripe/stripe.js

如果我记得,还有一个条带 npm 包。我不知道它是最新的。

于 2014-08-27T15:46:58.840 回答
1

这不是官方认可的 AFAICT,因此可能随时中断,但您可以像这样安装脚本:

bower install --save stripe.js=https://js.stripe.com/v2/stripe.js

这将创建一个index.js您应该能够正常使用的文件。

于 2015-02-15T08:49:16.423 回答
0

您可以尝试使用 重命名文件broccoli-file-mover。请参阅http://iamstef.net/ember-cli/#customizing-a-built-in-asset

于 2014-07-10T18:27:29.230 回答