GithubHelp home page GithubHelp logo

alastairparagas / cordova-minify Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 22.0 378 KB

Cordova hook that uglifies and minifies your app's Javascript files, minifies CSS files and HTML files, and compresses your image files.

License: MIT License

JavaScript 100.00%

cordova-minify's Introduction

Banner Image

Hi, I'm Alastair Paragas! I currently work as an engineer at Apple's Machine Learning Platform and Technology team, under Apple ML/AI in Seattle. I am also a part-time MSCS grad student at Georgia Tech specializing in Machine Learning graduating Fall 2020. You can also visit me at my personal website, aparagas.com!

For some of my past work and internship experiences, catch me around the 'net at:

  • European Organization for Nuclear Research (2017), Geneva, Switzerland - https://cds.cern.ch/record/2280009 - a keyword recommendation and anomaly-detection engine for Zenodo (CERN's public research paper repository)
  • Wolfram Summer School Alumni (2015), Waltham, MA - https://education.wolfram.com/summer/school/alumni/2015/, where I got to build a block-based programming environment, much like Scratch, powered by the Wolfram Language and environment - extra cool that we got mentored by Stephen Wolfram himself!
  • FIU Honors College, Miami, FL - where I got to build the first course registration system during freshman year (Honors CRS) and the MyHonors student portal!

I mantain some of my grad school notes here, and hoping to finish cataloguing these in due time, with courses ranging from:

  • CS7641 - Machine Learning - aimed to be a whirlwind tour on all topics related to the field of Machine Learning, which covers all classes of algorithms that perform "better" over time either through training or experience.
  • CS7624 - Reinforcement Learning - a course solely focused on Reinforcement Learning, a sub-area of Machine Learning focused on classes of algorithms that modify and improve their performance based on experience.
  • ISYE 6644 - Simulation - a grad-level Statistics course focusing on Simulation - the most powerful and flexible way of solving problems mathematically besides usual analytical and numerical methods as learned in previous Math courses. Focuses on the statistical theory behind generating random variates drawn from various probability distributions, input and output analysis, Brownian Motion and many more, serving as a quite good review of Calc 1-3 and Differential Equations
  • CS7638 - High Performance Computer Architecture - covers modern computer architecture, including branch prediction, out-of-order instruction execution, cache optimizations, multi-level caches, memory and storage, cache coherence and consistency, and multi- and many-core processors
  • ... and many more!

Feel free to browse through my GitHub repositories - featuring some personal projects and hackathon projects (mostly) from my time in undergrad - where we spent hours driving/flying across the country, nights without sleep and memories to share. Some cool stuff to call out were:

  • Nightwatch - an IoT wearable that will statistically analyze and alert for Seizures, Sleep Paralysis, Sleep Apnea, Narcolepsy and Brigada
  • MetroBoom - a peer-to-peer jukebox to solve an issue of my friends having to deal with my strange music (and audio recordings) while spending hours driving from South Florida to various hackathons
  • Tidbit - a Chrome extension that summarizes web content using NLP, with a cool Haskell backend!
  • Halcyon - a web browser for visually impaired people, complete with capabilities for human operator assistance, web summarization and voice/utterance based navigation
  • Ellery - our very own advising and course planning student portal wrapping over MyFIU, using predictive stats to calculate best options to take in terms of courses and grades!
  • Cambio - a Markdown-based encrypted over SMTP/POP3 web browser

cordova-minify's People

Contributors

alastairparagas avatar kurtz1993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cordova-minify's Issues

npm package is outdated?

Hi, I noticed you fixed the imagemin requirement (formerly image-min) but the version installed via npm install cordova-minify still has require("image-min"), could you verify? Cheers and thanks for your work!

Error running on Mac

Your hook install fine on my PC, but it threw the following error while trying to use it on a Mac.

module.js:340
throw err;
^
Error: Cannot find module 'imagemin-gifsicle'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/mapometer/Documents/development/mobile_app/node_modules/cordova-minify/node_modules/image-min/index.js:165:27)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Hook failed with error code 8: /Users/mapometer/Documents/development/mobile_app/hooks/after_prepare/minify.js

Manually installing the missing dependencies for image-min fixed the issue.

I also notice that image-min has not been updated for 6 months and that it's github page no longer exists. Github now redirects to the page for another NPM module 'imagemin' (no dash). This is at github.com/imagemin/imagemin.

Not able to get working

Hello,

I installed the plugin by running "npm install cordova-minify --save-dev" in the root folder of my app. When running "cordova build ios", I see "Running command: .../app/hooks/after_prepare/minify.js .../app" but "ios/www" nor "android/assets/www" are minified. Am I doing something wrong? I'm running Cordova CLI 4.1.2 if that makes a difference.

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');

});

Using the hook causes Ionic to be unable to find modules.

I've compiled my application using the minify hook, but when I try to run it I get a message in the debugger that says it cannot be able to find the module:
capture

Tried adding the .min.js file of ionic bundle, similar result:
capture1

Will Ionic support be added?

execvp(): Permission denied error

Hello,

I've installed your hook. After typing "cordova prepare android", it gives me that error:

Running command: /projectpath/hooks/after_prepare/minify.js /projectpath
execvp(): Permission denied

Cannot find module 'image-min'

I installed trought NPM.
When I try to build the app the following errors occurs:

captura de tela 2016-03-15 as 15 00 44

Resolved changing line 8 on /hooks/after_prepare/minify.js:

'image-min' to 'imagemin'

Before:
captura de tela 2016-03-15 as 15 05 15

After:
captura de tela 2016-03-15 as 15 05 24

Everything works fine now!

Too long path names on windows

The node-modules required by cordova-minify has image-min, which has too many dependencies. On windows, this results into a very deep folder structure, which creates a problem while trying to copy the "node-modules" to a different folder. It gives "Source path too long" error when trying to copy the node-modules to a new location.

Hook doesn't start. Node env error.

Hi! When I try to run cordova prepare ios I get

env: node\r: No such file or directory
Hook failed with error code 127: /Users/ma/Devel/ionictosmobileapp/hooks/after_prepare/minify.js

When I run in my term /usr/bin/env node it works fine.

Maybe you can help to figure out? Thanks.

OS X 10.10, node v0.10.32, Cordova 3.6.3-0.2.13

Not working

I don't know still if it is a bug
but the installation succeed with no issue, but I don't see anything that can tell that the module is doing anything during or after the build.

I see the after_prepare js file.

is there something I can do to test if it working?

Node modules not being picked up

Hi, on windows (don't know if it happens on other OS's, but I guess not) minify.js halts on account of not finding module uglify.js (if I swap lines var UglifyJS = require('uglify-js'); var CleanCSS = require('clean-css'); it will complain it doesn't find clean-css). I'm guessing this is due to the fact it searches for the modules inside the hooks/after_prepare folder, and it can't find them: I suggest you change that to:

var UglifyJS = require(path.join("..", "..", "node_modules", "cordova-minify", "node_modules", 'uglify-js'));

(same goes for the clean-css and imagemin dependencies).
Cheers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.