Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minify the distribution file #98

Closed
4 tasks
ccpandhare opened this issue Aug 28, 2017 · 27 comments
Closed
4 tasks

Minify the distribution file #98

ccpandhare opened this issue Aug 28, 2017 · 27 comments

Comments

@ccpandhare
Copy link
Collaborator

ccpandhare commented Aug 28, 2017

First Timers Only

Hi, this is a first-timers-only issue. This means this has been worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

The Problem

Image Sequencer has a lot of source files and hence the distribution ends up being pretty large, we can do our bit by minifying the distribution file.

All the source files are located in ./src/

The Solution

Grunt has different modules for different tasks. One such module is grunt-contrib-uglify. This package will uglify(or minify) your JS files so that they take less space (by removing whitespaces, line breaks and comments).

What you'll have to do is install this module as a developer dependancy by doing this:

image-sequencer $ npm install --save-dev grunt-contrib-uglify

Now you can use this in Image Sequencer. What grunt does is defined in the Gruntfile ( ./Gruntfile.js )

There is a task "build" defined in the Gruntfile. In the build task, what is already being done is that the src files are browserified into one single distribution file.

In the same task, add the grunt-contrib-minify such that the ./dist/image-sequencer.js generated above is minified and exported as ./dist/image-sequencer.min.js.

Steps to Fix

  • Claim this issue with a comment here, and ask for any issues/clarifications.
  • Clone this repository locally.
  • Try to fix the issue as described above, but even before you have completed doing so, you can:
  • Commit your work and initiate a Pull Request (Mark it as work-needed if you haven't completed the work on the issue)
@divyamamgai
Copy link

Can I take up this issue? I want to get started with Open Source contribution and this seems a good place to start since I already have experience with this.

@ccpandhare
Copy link
Collaborator Author

Sure!!
:-)

@divyamamgai
Copy link

divyamamgai commented Aug 29, 2017

Can you guide me as to how do I initiate the build?
Looks like we are using ES6 and uglify doesn't provide support for that. I have found a solution here - How to integrate uglify-es in grunt?, tell me if this is fine. Also I don't see a linting file should we add that too?

@ccpandhare
Copy link
Collaborator Author

As far as I know, There's no ES6 code...
The dependencies might be using ES6.

@ccpandhare
Copy link
Collaborator Author

What was the problem you faced?

@divyamamgai
Copy link

const keyword is used which is in the spec for ES6 but not the previous ones, so uglify is throwing unknown keyword exception. Maybe we can just change them to var?

@ccpandhare
Copy link
Collaborator Author

Ohh okay. I see.
Yes I think that can be done. Will have a look. Thanks!

@divyamamgai
Copy link

Do you want me to do those changes in this PR or are you going to do those in a separate one?

@ccpandhare
Copy link
Collaborator Author

ccpandhare commented Sep 1, 2017 via email

@ccpandhare
Copy link
Collaborator Author

Fixed that in #104
Thanks for you patience and sorry for the delay!

@divyamamgai
Copy link

Okay I'll pull the latest and start working on this PR.

@ccpandhare
Copy link
Collaborator Author

Thanks!

@divyamamgai
Copy link

divyamamgai commented Sep 4, 2017

Hey, on doing grunt build I'm still getting const variables in the dist js, like I8 and I64. Can you help? I have forked the latest master.

@ccpandhare
Copy link
Collaborator Author

ccpandhare commented Sep 5, 2017 via email

@ccpandhare
Copy link
Collaborator Author

I checked. Some more "const"s were there; I removed the const identifiers from our code, but one of our dependencies has it. So we will have to go ahead with a solution which supports ES6.

@divyamamgai
Copy link

Okay, I'll look into the ES6 supporting solution, it had some issues but I'll keep you posted.

@makeupsomething
Copy link

If this is still available id love to have a go at it

@ccpandhare
Copy link
Collaborator Author

ccpandhare commented Sep 29, 2017 via email

@divyamamgai
Copy link

I'm sorry, but I have got some urgent work to take care so yeah you can go ahead and to this.

@maybenat
Copy link

First timer here. Can I take a stab at this?

@jywarren
Copy link
Member

jywarren commented Oct 13, 2017 via email

@divyamamgai
Copy link

Is this still open? I see that in the master uglify task has been added and is working using the harmony branch of grunt-contrib-uglify.

@jywarren
Copy link
Member

jywarren commented Oct 13, 2017 via email

@divyamamgai
Copy link

Sorry, but currently I'm occupied with something. I'll finish that up in two weeks. After that I will take up an issue to resolve.

@makeupsomething
Copy link

@jywarren @divyamamgai @ccpandhare
Sorry, i made a pull request for this issues a while back and didn't realise it had been merged already.

@jywarren
Copy link
Member

Ah, well, it looks like this is indeed resolved so I'll close it. Sorry for the confusion folks, and we've been adding new issues we'd love help with! Thank you all very much!

@jywarren
Copy link
Member

Addressed in #124

@gitmate gitmate bot mentioned this issue Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants