Skip to content

Commit

Permalink
Add custom license plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
eKoopmans committed Nov 25, 2017
1 parent 8932d4a commit ae199cc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import pkg from './package.json';
import fs from 'fs';

function license(filename) {
filename = filename || './LICENSE';
var data = fs.readFileSync(filename).toString();
console.log(data);
console.log(typeof data);
data = '/**\n * @license\n * ' + data.trim().replace(/\n/g, '\n * ') + '\n */\n';
return { banner: data };
}

export default [
// Bundled builds.
Expand All @@ -17,7 +27,8 @@ export default [
},
plugins: [
resolve(),
commonjs()
commonjs(),
license('./LICENSE')
]
},
// Un-bundled builds.
Expand All @@ -40,7 +51,8 @@ export default [
},
plugins: [
resolve(),
commonjs()
commonjs(),
license('./LICENSE')
]
}
];

0 comments on commit ae199cc

Please sign in to comment.