如何添加带有凉亭的非琥珀色图书馆? (例如处理js) [英] How to add a non-Amber library with bower? (for example processing js)

查看:84
本文介绍了如何添加带有凉亭的非琥珀色图书馆? (例如处理js)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用amber init然后是bower install processing --save来获取 processing.js 已添加. 我用

I have started a project with amber init and then bower install processing --save to get processing.js added. I do the initialisation with

firstProcessingInstance

     <return Processing.instances[0]>

该方法由实例方法initialize调用,并且工作于Amber v0.13之前的版本.

This method is called by the instance method initializeand it worked a pre-Amber v0.13 version.

如何在Amber 0.13和0.14中初始化Processing.js?

How do I initialize Processing.js in Amber 0.13 and 0.14?

示例代码为此处

在版本0.13和0.14中,必须手动将配置文件processing.amd.json添加到根目录.如果库目录中没有local.amd.json文件,则需要项目根目录中的文件libraryname.amd.json.

In version 0.13 and 0.14 a configuration file processing.amd.json has to be added manually to the root directory. Files libraryname.amd.json in the root directory of the project are needed if the library does not have a local.amd.json file in the library directory.

Amber Smalltalk和Helios的libraryname.amd.json文件的示例是

Examples for libraryname.amd.json files from Amber Smalltalk and Helios are

琥珀色项目;文件jquery.amd.json

project amber; file jquery.amd.json

{
"paths": {
           "jquery": ["dist/jquery", "jquery"]
         }
}

琥珀色项目;文件es5-shim.amd.json

project amber; file es5-shim.amd.json

{
"paths": {
           "amber_lib/es5-shim": "."
         }
}

太阳神计划;文件showdown.amd.json

project helios; file showdown.amd.json

{
"paths": {
    "helios/showdown": "src/showdown"
}
}

项目: https://github.com/hhzl/Amber-snapsvg-demo 文件:snap.svg.amd.json

project: https://github.com/hhzl/Amber-snapsvg-demo file: snap.svg.amd.json

{
"paths": {
          "snap.svg" : "dist/snap.svg"
         }
}

参考文献

  • 琥珀可能是项目和图书馆
  • 乐高积木插图
  • References

    • Amber may be a project and a library
    • Lego bricks illustration
    • processing.amd.json库映射文件怎么了?

      {
      "paths": {
                  "processing" : "processing"
               }
      }
      

      注意 processing.amd.json中的更改后,运行grunt devel

      Note After a change in processing.amd.json run grunt devel

      推荐答案

      将外部非Amber库添加到项目中不仅需要安装Bower,还需要更多步骤.您必须在项目的根目录中创建libdir.amd.json,并将库文件映射到符号名称.然后,应将符号名称添加到deploy.js或devel.js(取决于使用它的上下文)中, outside 用于琥珀色包装的位置(即不在两个定界符注释之间.

      Adding external non-Amber library to the project involves more steps than just bower install. You must create libdir.amd.json in root of the project with mapping the library file to the symbolic name. Then, you should add the symbolic name into either deploy.js or devel.js (depending on the context in which it is used), outside the place intended for amber packages (that is, not between the two delimiter comments).

      引用的processing.amd.json没有什么错,这是正确的.这样,"processing"模块名称将映射到.../processing/processing(根据设计,AMD映射中将省略.js).毕竟,请参见config.js以检查映射是否正确.如果您在加载processing.js时遇到问题,则该域不在此域内(.amd.json和Amber的映射).

      There is nothing wrong with the cited processing.amd.json, it's right and correct. With this, "processing" module name is mapped to .../processing/processing (.js is omitted from AMD mapping by design). After all, see your config.js to check the mapping is correct. If you have problems loading processing.js, it is outside this domain (.amd.json and Amber's mappings).

      这篇关于如何添加带有凉亭的非琥珀色图书馆? (例如处理js)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆