如何在grunt中包含javascript库

时间:2016-08-05 05:27:37

标签: javascript angularjs ionic-framework gruntjs

我正在研究现有的离子项目。我试图在这个项目中包含Ionic的推送通知功能。当我尝试运行grunt命令时出现以下错误

Running "jsbeautifier:files" (jsbeautifier) task
Beautified 53 files, changed 0 files...OK

Running "jshint:files" (jshint) task

   ./www/js/app.js
     18 |        var push = new Ionic.Push({
                                ^ 'Ionic' is not defined.

所以看起来lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js下的离子JS文件没有被加载到grunt中。如何解决这个问题?我是新来的咕噜和离子,所以请帮助我。我没有在其他类似的问题中找到任何解决方案。 顺便说一句,该应用程序在浏览器中运行良好。

gruntfile.js jshint

jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                eqnull: true,
                browser: true,
                strict: false,
                globalstrict: false,
                node: true,
                undef: true,
                globals: {
                    angular: true,
                    cordova: true,
                    app: true,
                    StatusBar: true,
                    CameraPopoverOptions: true,
                    ionic: true,
                    Camera: true
                },
            },

            files: {
                src: ["*.js", "./www/js/*.js", "./www/components/**/*.js", "!*.min.js", "!./www/**/*.min.js", "!./www/**/**/*.min.js"]
            }

        },

1 个答案:

答案 0 :(得分:1)

globals: {
    angular: true,
    cordova: true,
    app: true,
    StatusBar: true,
    CameraPopoverOptions: true,
    Ionic: true,
    Camera: true
}

Ionic应该有大写I

相关问题