Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gruntjs 聚合物,grunt硫化:prototype.registerCallback不是一个函数_Gruntjs_Polymer_Polymer 1.0 - Fatal编程技术网

Gruntjs 聚合物,grunt硫化:prototype.registerCallback不是一个函数

Gruntjs 聚合物,grunt硫化:prototype.registerCallback不是一个函数,gruntjs,polymer,polymer-1.0,Gruntjs,Polymer,Polymer 1.0,我正在尝试使用Polymer创建一个非常简单的HTML页面,其中包括一个HTML文件,其中包含我需要的所有组件: <link rel="import" href="bower_components/iron-ajax/iron-ajax.html"> <link rel="import" href="components/my-element.html"> 当我按原样运行时,一切正常 当我尝试硫化components.html文件,然后用硫化版本打开同一页面时,控制台中

我正在尝试使用Polymer创建一个非常简单的HTML页面,其中包括一个HTML文件,其中包含我需要的所有组件:

<link rel="import" href="bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="components/my-element.html">
当我按原样运行时,一切正常

当我尝试硫化
components.html
文件,然后用硫化版本打开同一页面时,控制台中出现以下错误

“未捕获的TypeError:prototype.registerCallback不是函数”

我注意到硫化过程会发生转变

    Polymer({
        is: 'my-element',
        properties:{
            // properties
        }
    });
进入

这似乎是导致错误的原因,因为window.Polymer只需要一个对象作为参数

我正在使用进行实际硫化,我的配置如下所示:

<link rel="import" href="../bower_components/polymer/polymer.html">
<polymer-element name="my-element">
  <template>
    // Some HTML
  </template>
  <script>
    Polymer({
        is: 'my-element',
        properties:{
            // properties
        }
    });
  </script>
</polymer-element>
vulcanize: {
    default: {
        options: {
            excludes: {
              imports: [
                'polymer.html'
              ]
            },
            'strip-excludes': false,
            inline: true,
            strip: true
        },
        files: {
            'build.html': 'components.html'
        },
    },
}
有没有办法阻止这一切


我用的是聚合物1.0,grunt硫化0.6.4,明白了:我用的是
而不是
<代码>适用于聚合物1.0

本指南很有用,我花了好几天时间才找到,如果只是为了让您知道什么适用于0.5,什么适用于1.0:


grunt硫化版与硫化版1.8.1不兼容,因为github的上一次更新是在2月9日,版本为0.6.4。这是聚合物0.8+的过时插件

与硫化胶^1.8.1和聚合物1.0配合使用的grunt硫化胶的临时适配。

只需更改package.json:
“grunt硫化橡胶”:“kgadzinowski/grunt硫化橡胶”

它会很好用的

vulcanize: {
    default: {
        options: {
            excludes: {
              imports: [
                'polymer.html'
              ]
            },
            'strip-excludes': false,
            inline: true,
            strip: true
        },
        files: {
            'build.html': 'components.html'
        },
    },
}