Skip to content

Commit

Permalink
preserve license in min.js builds
Browse files Browse the repository at this point in the history
  • Loading branch information
oyejorge committed Nov 10, 2020
1 parent aa56deb commit d91aa83
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ const banner = `/**
*/
`;

var terser_config = terser({
mangle: true,
format: {
comments: function (node, comment) {
var text = comment.value;
var type = comment.type;
if (type == "comment2") {
// multiline comment
return /\* Tom Select/i.test(text);
}
},
},
});


function createConfig( input, output, plugins ){

Expand Down Expand Up @@ -94,16 +108,16 @@ files.map(function(file){
var custom_file = path.resolve(__dirname,'../src/tom-select.custom.js');
if( fs.existsSync(custom_file) ){
configCore(custom_file,'tom-select.custom.js');
configCore(custom_file,'tom-select.custom.min.js',[terser({mangle:true})]);
configCore(custom_file,'tom-select.custom.min.js',[terser_config]);
}

// tom-select.base
configCore('src/tom-select.js','tom-select.base.js')
configCore('src/tom-select.js','tom-select.base.min.js',[terser({mangle:true})]);
configCore('src/tom-select.js','tom-select.base.min.js',[terser_config]);

// tom-select.complete
configCore('src/tom-select.complete.js','tom-select.complete.js');
configCore('src/tom-select.complete.js','tom-select.complete.min.js',[terser({mangle:true})]);
configCore('src/tom-select.complete.js','tom-select.complete.min.js',[terser_config]);



Expand Down

0 comments on commit d91aa83

Please sign in to comment.