cordova-minify
cordova-minify copied to clipboard
Not minifying JS
Hi, In my cordova-ionic app i have installed cordova-minify-2. It got succesfully installed but whenever i am trying to do ionic cordova build ios --release it's throwing me below error.
cordova-minify STARTING - minifying your js, css, html, and images. Sit back and relax!
Encountered an error minifying a file: /Users/bhushanrane/Movies/PushNotification/myApp 2/platforms/ios/www/js/app.js {"error":{"message":"Invalid flags supplied to RegExp constructor 'bhushanrane'","filename":"0","line":1,"col":0,"pos":0}}
After i tried to install cordova-minify. Then it's replacing my platform JS file containing undefined.
Kindly, help me on this. Let me know if i am missing anything.
My JS file: angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
.run(function($ionicPlatform,$rootScope) { $ionicPlatform.ready(function() { // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard // for form inputs) if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
// Push Notifications Code
var options = {
android: {
senderID: "569340058386"//"678047950428"
},
ios: {
alert: "true",
badge: "true",
sound: "true",
clearBadge: "true"
},
windows: {}
};
const push = PushNotification.init({ android: { senderID: "569340058386" }, browser: { pushServiceURL: 'http://push.api.phonegap.com/v1/push' }, ios: { alert: "true", badge: "true", sound: "true" }, windows: {} });
push.on('registration', (data) => { // data.registrationId alert('Success--' + data.registrationId); });
push.on('notification', (data) => { // data.message, // data.title, // data.count, // data.sound, // data.image, // data.additionalData });
push.on('error', (e) => { // e.message });
// $cordovaPushV5.initialize(options).then(function() {
// // start listening for new notifications // $cordovaPushV5.onNotification(); // // start listening for errors // $cordovaPushV5.onError();
// $cordovaPushV5.register().then(function (result) { // console.log("Register success " + result); // $rootScope.pushDeviceToken = result; // console.log("Device Token for Push"+result); // //$cordovaToast.showShortCenter('Registered for push notifications'); // //$scope.registerDisabled=true; // // ** NOTE: Android regid result comes back in the pushNotificationReceived, only iOS returned here // // if (ionic.Platform.isIOS()) { // // $scope.regId = result; // // storeDeviceToken("ios"); // // } // }, function (err) { // alert("Register error " + err); // }); // }); // $rootScope.$on('$cordovaPushV5:notificationReceived', function (event, notification) { // if(notification.message){ // $cordovaDialogs.alert(notification.message, ALERT_MESSAGE.ALERT_TITLE, 'OK') .then(function () { // }); // } // });
// $rootScope.$on('$cordovaPushV5:errorOcurred', function (event, e) { // $cordovaDialogs.alert(e, ALERT_MESSAGE.ALERT_TITLE, 'OK') .then(function () { // }); // });
}); })
.config(function($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states // Learn more here: https://github.com/angular-ui/ui-router // Set up the various states which the app can be in. // Each state's controller can be found in controllers.js $stateProvider
// setup an abstract state for the tabs directive .state('tab', { url: '/tab', abstract: true, templateUrl: 'templates/tabs.html' })
// Each tab has its own nav history stack:
.state('tab.dash', { url: '/dash', views: { 'tab-dash': { templateUrl: 'templates/tab-dash.html', controller: 'DashCtrl' } } })
.state('tab.chats', { url: '/chats', views: { 'tab-chats': { templateUrl: 'templates/tab-chats.html', controller: 'ChatsCtrl' } } }) .state('tab.chat-detail', { url: '/chats/:chatId', views: { 'tab-chats': { templateUrl: 'templates/chat-detail.html', controller: 'ChatDetailCtrl' } } })
.state('tab.account', { url: '/account', views: { 'tab-account': { templateUrl: 'templates/tab-account.html', controller: 'AccountCtrl' } } });
// if none of the above states are matched, use this as the fallback $urlRouterProvider.otherwise('/tab/dash');
});