srod/node-minify

glob not working with cli

justclint opened this issue · 2 comments

Using cli Im trying to recursively minify files like:

node-minify --compressor uglify-js --input 'source/**/*.js' --output 'source/**/*.min.js' --option '{"warnings": true, "mangle": false}'

but throws error:

✖ Error - file(s) not compressed with uglify-js
{ Error: ENOENT: no such file or directory, stat 'source/**'
    at Object.statSync (fs.js:855:3)
    at createDirectory (/var/www/project/node_modules/@node-minify/core/lib/compress.js:102:20)
    at compress (/var/www/project/node_modules/@node-minify/core/lib/compress.js:36:3)
    at Promise (/var/www/project/node_modules/@node-minify/core/lib/core.js:30:7)
    at new Promise (<anonymous>)
    at minify (/var/www/project/node_modules/@node-minify/core/lib/core.js:25:10)
    at Promise (/var/www/project/node_modules/@node-minify/cli/lib/compress.js:31:23)
    at new Promise (<anonymous>)
    at compress (/var/www/project/node_modules/@node-minify/cli/lib/compress.js:30:10)
    at Promise (/var/www/project/node_modules/@node-minify/cli/lib/cli.js:52:35)
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: 'source/**' }

In the example above, I just want to minify all js files recursively and save the minified file in the same folder as its source js file.

Is glob not supported or is there another method/syntax to do this?

Thanks!

srod commented

Fixed in 6.0.0.

srod commented

You should use that command:

node-minify --compressor uglify-js --input 'source/**/*.js' --output 'source/$1.min.js' --option '{"warnings": true, "mangle": false}'