Good Citizen: Copyrights and Licenses

Published:

Last updated:

Estimated reading time: 2 minutes

A lot of us follow most legal laws to remain good citizens and mostly to stay out of trouble. The best people are those who follow these laws because they feel it’s the right thing to do, and not just because they may get arrested for doing otherwise. In the Software development industry, there are licenses and copyright laws. These laws are ignored by many and I used to be one.

While working on a rails project recently, I had upgraded my version of rails from 4.1.7 to 4.2. In the process, my uglifier gem had upgraded to version 2.7.1 and that was cool. I love updated stuff!

The one thing about the uglifier update I was not pleased with initially was its copyright comment preservation. Uglifier started allowing comments that had a bang to remain unminified and this kept giving me a warning from my rule based metric that JavaScript is not minified because of some whitespaces sold off with the copyright comment lines.

/*!
* jQuery JavaScript Library v2.1.3
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2014-12-18T15:11Z
*/

I wanted nothing more than to get rid of this and my resort was to edit my production configuration from

config.assets.js_compressor = :uglifier

to

config.assets.js_compressor = Uglifier.new(output: { comments: :none })

At this point, I’m including jquery2 with sprockets and sizzlejs with it.

//= require jquery2

With a change in the production configuration, I got my JS file smoothly minified the way I want it and then I started writing this blog post to tell anyone else trying to get rid of it that this is how I’ve gone about it. Then I read this tldr MIT license which was an eye opener for me. I’ve taken licenses and copyrights with lethargy for so long and this was a turn-around for me and I needed to get back the copyrighted JQuery in my app and at the same time keep most of it minified. Luckily there’s a minified jquery2 that can be included with sprockets

//= require jquery2.min

That has a single-line copyright with less white-space and it was my go.

/*! jQuery v2.1.3 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */

If you’re privileged to use a software or product for free. For all its worth which may be inclusion of License and Copyrights, we’ll be good software community citizens by keeping them.

Newer post

Using Rails assets pipeline with Cloudfront CDN

Older post

Understanding how ajax upload preview works

Responses

You may respond to this post by referencing it on your blog, twitter, or any website