[英]How to add a non-Amber library with bower? (for example processing js)
I have started a project with amber init
and then bower install processing --save
to get processing.js added. 我已经用
amber init
开始了一个项目,然后进行bower install processing --save
以添加processing.js 。 I do the initialisation with 我用
firstProcessingInstance
<return Processing.instances[0]>
This method is called by the instance method initialize
and it worked a pre-Amber v0.13 version. 该方法由实例方法
initialize
调用,并且它的版本为Amber v0.13之前的版本。
How do I initialize Processing.js in Amber 0.13 and 0.14? 如何在Amber 0.13和0.14中初始化Processing.js?
The code of the example is here 示例代码在这里
In version 0.13 and 0.14 a configuration file processing.amd.json
has to be added manually to the root directory. 在版本0.13和0.14中,必须手动将配置文件
processing.amd.json
添加到根目录中。 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. 文件
libraryname.amd.json
如果库没有一个需要在项目的根目录local.amd.json
在图书馆目录中的文件。
Examples for libraryname.amd.json
files from Amber Smalltalk and Helios are Amber Smalltalk和Helios的
libraryname.amd.json
文件的示例是
project amber; 琥珀色项目; file jquery.amd.json
文件jquery.amd.json
{
"paths": {
"jquery": ["dist/jquery", "jquery"]
}
}
project amber; 琥珀色项目; file es5-shim.amd.json
文件es5-shim.amd.json
{
"paths": {
"amber_lib/es5-shim": "."
}
}
project helios; 日光浴项目; file showdown.amd.json
文件showdown.amd.json
{
"paths": {
"helios/showdown": "src/showdown"
}
}
project: https://github.com/hhzl/Amber-snapsvg-demo file: snap.svg.amd.json 项目: https ://github.com/hhzl/Amber-snapsvg-demo文件:snap.svg.amd.json
{
"paths": {
"snap.svg" : "dist/snap.svg"
}
}
What is wrong with this processing.amd.json
library mapping file? 此
processing.amd.json
库映射文件怎么了?
{
"paths": {
"processing" : "processing"
}
}
Note After a change in processing.amd.json
run grunt devel
注意在
processing.amd.json
进行更改后,运行grunt devel
Adding external non-Amber library to the project involves more steps than just bower install. 将外部非Amber库添加到项目中不仅需要安装Bower,还需要更多步骤。 You must create libdir.amd.json in root of the project with mapping the library file to the symbolic name.
您必须在项目的根目录中创建libdir.amd.json,并将库文件映射到符号名称。 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).
然后,应将符号名称添加到deploy.js或devel.js中(取决于使用的上下文),该符号名称位于用于琥珀色包的位置之外 (即, 不在两个定界符注释之间)。
EDIT: There is nothing wrong with the cited processing.amd.json
, it's right and correct. 编辑:引用的
processing.amd.json
没有任何问题,这是正确的。 With this, "processing"
module name is mapped to .../processing/processing
( .js
is omitted from AMD mapping by design). 这样,
"processing"
模块名称将映射到.../processing/processing
(根据设计,AMD映射会省略.js
)。 After all, see your config.js
to check the mapping is correct. 毕竟,请参阅
config.js
以检查映射是否正确。 If you have problems loading processing.js
, it is outside this domain ( .amd.json
and Amber's mappings). 如果您在加载
processing.js
遇到问题,则它不在此域内( .amd.json
和Amber的映射)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.