我想使用 THIS javascript开发工具包将内容导入流星模板。
首先,我不确定什么是可取的,让我的主要流星模板用空格键构建
{{title}}
或使用Prismic.io的谓词系统
[:d = namespace.operator(<fragment>, <title>)]
(我知道必须以某种方式使用谓词将它们存储在变量中并以某种方式将其传递给空格键。)
除此之外,我甚至无法让我的Meteor应用程序运行。我有以下html文件
的test.html
<head>
<meta charset="utf-8">
<title>Prismic.io Javascript kit Test Suite</title>
</head>
<template name="test">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</template>
unit.html
<head>
<meta charset="utf-8">
<title>Prismic.io Javascript kit Test Suite</title>
</head>
<template name="quint">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</template>
doc.html
<head>
<meta charset="utf-8">
<title>Prismic.io Javascript kit Test Suite</title>
</head>
<template name ="doc">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</template>
fragments.html
<head>
<meta charset="utf-8">
<title>Prismic.io Javascript kit Test Suite</title>
</head>
<template name="fragments">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</template>
好的,我的问题开始了。我在/src , /dis , /libs
Meteor在下面抛出这个长错误。错误中的第一个引用是future.js:183,错误 ReferenceError:窗口未定义我的初步猜测是这是Meteor没有的npm依赖项。我不确定,如果是这样,我怎样才能让这个开发工具包在Meteor中工作。或者我是否必须使用meteor通过临时向prisimic.io / api发出http请求。
谢谢!对于任何先进的帮助。
W20141019-16:24:20.945(-7)? (STDERR)
W20141019-16:24:20.999(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:24:20.999(-7)? (STDERR) throw(ex);
W20141019-16:24:21.000(-7)? (STDERR) ^
W20141019-16:24:21.000(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:24:21.000(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:2:6569
W20141019-16:24:21.000(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:4:3
W20141019-16:24:21.001(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:24:21.001(-7)? (STDERR) at Array.forEach (native)
W20141019-16:24:21.001(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:24:21.001(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
W20141019-16:24:25.767(-7)? (STDERR)
W20141019-16:24:25.769(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:24:25.770(-7)? (STDERR) throw(ex);
W20141019-16:24:25.770(-7)? (STDERR) ^
W20141019-16:24:25.770(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:24:25.770(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:2:6569
W20141019-16:24:25.771(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:4:3
W20141019-16:24:25.771(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:24:25.771(-7)? (STDERR) at Array.forEach (native)
W20141019-16:24:25.771(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:24:25.771(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
W20141019-16:24:29.844(-7)? (STDERR)
W20141019-16:24:29.846(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:24:29.846(-7)? (STDERR) throw(ex);
W20141019-16:24:29.847(-7)? (STDERR) ^
W20141019-16:24:29.847(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:24:29.847(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:2:6569
W20141019-16:24:29.848(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:4:3
W20141019-16:24:29.848(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:24:29.848(-7)? (STDERR) at Array.forEach (native)
W20141019-16:24:29.848(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:24:29.848(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
=> Modified -- restarting.
W20141019-16:26:33.472(-7)? (STDERR)
W20141019-16:26:33.474(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:26:33.475(-7)? (STDERR) throw(ex);
W20141019-16:26:33.475(-7)? (STDERR) ^
W20141019-16:26:33.475(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:26:33.475(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:2:6569
W20141019-16:26:33.476(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:4:3
W20141019-16:26:33.476(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:26:33.476(-7)? (STDERR) at Array.forEach (native)
W20141019-16:26:33.476(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:26:33.477(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
=> Modified -- restarting.
W20141019-16:26:40.114(-7)? (STDERR)
W20141019-16:26:40.116(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:26:40.116(-7)? (STDERR) throw(ex);
W20141019-16:26:40.117(-7)? (STDERR) ^
W20141019-16:26:40.117(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:26:40.117(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:2:6569
W20141019-16:26:40.117(-7)? (STDERR) at app/js/dist/prismic.io-1.0.10.min.js:4:3
W20141019-16:26:40.118(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:26:40.118(-7)? (STDERR) at Array.forEach (native)
W20141019-16:26:40.118(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:26:40.118(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
=> Modified -- restarting.
W20141019-16:26:47.834(-7)? (STDERR)
W20141019-16:26:47.836(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:26:47.836(-7)? (STDERR) throw(ex);
W20141019-16:26:47.837(-7)? (STDERR) ^
W20141019-16:26:47.837(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:26:47.837(-7)? (STDERR) at app/doc.js:529:3
W20141019-16:26:47.838(-7)? (STDERR) at app/doc.js:531:3
W20141019-16:26:47.838(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:26:47.838(-7)? (STDERR) at Array.forEach (native)
W20141019-16:26:47.838(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:26:47.839(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
W20141019-16:26:51.795(-7)? (STDERR)
W20141019-16:26:51.797(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:26:51.797(-7)? (STDERR) throw(ex);
W20141019-16:26:51.798(-7)? (STDERR) ^
W20141019-16:26:51.798(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:26:51.798(-7)? (STDERR) at app/doc.js:529:3
W20141019-16:26:51.798(-7)? (STDERR) at app/doc.js:531:3
W20141019-16:26:51.798(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:26:51.799(-7)? (STDERR) at Array.forEach (native)
W20141019-16:26:51.799(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:26:51.799(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
W20141019-16:26:55.752(-7)? (STDERR)
W20141019-16:26:55.754(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:26:55.755(-7)? (STDERR) throw(ex);
W20141019-16:26:55.755(-7)? (STDERR) ^
W20141019-16:26:55.755(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:26:55.755(-7)? (STDERR) at app/doc.js:529:3
W20141019-16:26:55.756(-7)? (STDERR) at app/doc.js:531:3
W20141019-16:26:55.756(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:26:55.756(-7)? (STDERR) at Array.forEach (native)
W20141019-16:26:55.756(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:26:55.757(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
=> Modified -- restarting.
W20141019-16:59:50.767(-7)? (STDERR)
W20141019-16:59:50.769(-7)? (STDERR) /Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141019-16:59:50.770(-7)? (STDERR) throw(ex);
W20141019-16:59:50.770(-7)? (STDERR) ^
W20141019-16:59:50.770(-7)? (STDERR) ReferenceError: window is not defined
W20141019-16:59:50.770(-7)? (STDERR) at app/doc.js:529:3
W20141019-16:59:50.771(-7)? (STDERR) at app/doc.js:531:3
W20141019-16:59:50.771(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:168:10
W20141019-16:59:50.771(-7)? (STDERR) at Array.forEach (native)
W20141019-16:59:50.771(-7)? (STDERR) at Function._.each._.forEach (/Users/anderskitson/.meteor/packages/meteor-tool/.1.0.34.1q6jdah++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141019-16:59:50.772(-7)? (STDERR) at /Users/anderskitson/acornmade/mrskitson/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
答案 0 :(得分:2)
尽管nicolsondsouza说道,但是Prismic套件兼容客户端(浏览器)和服务器端(Node.js)。
以下是我们检测Node.js的行(在每个文件的末尾): https://github.com/prismicio/javascript-kit/blob/master/src/api.js#L1176
似乎测试失败,我们使用&#34; window&#34;对于全球对象。我不确定Meteor与Node.js有多接近,但这条线需要进行调整才能与Meteor兼容。
其他特定于平台的代码是XHR,因此也可能存在不兼容性: https://github.com/prismicio/javascript-kit/blob/master/src/api.js#L26
我们很乐意支持Meteor.js - 我们会将其添加到我们的功能愿望清单中,如果您赶时间,拉取请求肯定会有所帮助!