sidgate
sidgate

Reputation: 15234

How to include javascript library in grunt

I am working on an existing Ionic project. I am trying to include the Ionic's push notification feature within this project. When I try to run grunt command I get following error

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. How to fix this? I am new to grunt and ionic, so please help me out. I didn't find any solution in other similar questions. BTW, the app works fine in browser.

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"]
            }

        },

Upvotes: 0

Views: 52

Answers (1)

Adam Harrison
Adam Harrison

Reputation: 363

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

Ionic should have capital I.

Upvotes: 1

Related Questions