简体   繁体   English

如何在grunt中包括javascript库

[英]How to include javascript library in grunt

I am working on an existing Ionic project. 我正在做一个现有的Ionic项目。 I am trying to include the Ionic's push notification feature within this project. 我正在尝试在此项目中包含Ionic的推送通知功能。 When I try to run grunt command I get following error 当我尝试运行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.

So looks like the ionic JS file under lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js is not getting loaded in grunt. 所以看起来lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js下的ionic JS文件没有被载入。 How to fix this? 如何解决这个问题? I am new to grunt and ionic, so please help me out. 我是刚开始学习咕and咕和离​​子的,所以请帮帮我。 I didn't find any solution in other similar questions. 在其他类似问题中我没有找到任何解决方案。 BTW, the app works fine in browser. 顺便说一句,该应用程序在浏览器中运行良好。

gruntfile.js jshint 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"]
            }

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

Ionic should have capital I . Ionic应该有资本I

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM