From 023cdbf86c9510d387b6cca8cd7d39af8b68d6a7 Mon Sep 17 00:00:00 2001 From: David Duponchel Date: Wed, 15 Jan 2014 23:35:27 +0100 Subject: [PATCH] change the grunt config for the issue #80 This commit updates the grunt configuration to ensure that the license comment (starting with /*! for the minifiers) makes its way to the final dist files. --- Gruntfile.js | 9 +++++++-- lib/index.js | 20 -------------------- lib/license_header.js | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 lib/license_header.js diff --git a/Gruntfile.js b/Gruntfile.js index 88d935e6..e6d5e053 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -82,14 +82,19 @@ module.exports = function(grunt) { }, options: { standalone: 'JSZip', - ignore:['./lib/nodeBuffer.js','./lib/nodeBufferReader'] + ignore:['./lib/nodeBuffer.js','./lib/nodeBufferReader'], + postBundleCB: function(err, src, done) { + var license = require('fs').readFileSync('lib/license_header.js'); + done(err, license + src); + } } } }, uglify: { options: { report: 'gzip', - mangle: true + mangle: true, + preserveComments: 'some' }, all: { src: 'dist/jszip.js', diff --git a/lib/index.js b/lib/index.js index 97ef7f20..b90be336 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,24 +1,4 @@ 'use strict'; -/*! - -JSZip - A Javascript class for generating and reading zip files - - -(c) 2009-2012 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. -*/ -/** -Usage: - zip = new JSZip(); - zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); - zip.folder("images").file("smile.gif", base64Data, {base64: true}); - zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); - zip.remove("tempfile"); - - base64zip = zip.generate(); - -**/ - /** * Representation a of zip file in js * @constructor diff --git a/lib/license_header.js b/lib/license_header.js new file mode 100644 index 00000000..17c6f707 --- /dev/null +++ b/lib/license_header.js @@ -0,0 +1,19 @@ +/*! + +JSZip - A Javascript class for generating and reading zip files + + +(c) 2009-2012 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. +*/ +/** +Usage: + zip = new JSZip(); + zip.file("hello.txt", "Hello, World!").file("tempfile", "nothing"); + zip.folder("images").file("smile.gif", base64Data, {base64: true}); + zip.file("Xmas.txt", "Ho ho ho !", {date : new Date("December 25, 2007 00:00:01")}); + zip.remove("tempfile"); + + base64zip = zip.generate(); + +**/