Skip to content

Commit

Permalink
Fixed minified file not written if only 1 unminified src passed/found
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Aug 29, 2024
1 parent aaa4727 commit e76a798
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions node.js/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,11 @@ const pkgName = '@adamlui/minify.js',
}
if (minifyData?.length == 0) return;

// Log + copy single result code if --copy passed
if (minifyData?.length == 1) {
// Copy single result code to clipboard if --copy passed
if (config.copy && minifyData?.length == 1) {
console.log(`\n${bw + minifyData[0].code + nc}`);
if (config.copy) {
printIfNotQuiet(`\n${ msgs.info_copying || 'Copying to clipboard' }...`);
ncp.writeSync(minifyData[0].code);
}
printIfNotQuiet(`\n${ msgs.info_copying || 'Copying to clipboard' }...`);
ncp.writeSync(minifyData[0].code);

} else { // write array data to files
printIfNotQuiet(`\n${ msgs.info_writing || 'Writing to file' }${ minifyData?.length > 1 ? 's' : '' }...`);
Expand Down

0 comments on commit e76a798

Please sign in to comment.