Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error! Unknown option '-' #24

Open
linen1996 opened this issue May 22, 2020 · 0 comments
Open

Error! Unknown option '-' #24

linen1996 opened this issue May 22, 2020 · 0 comments

Comments

@linen1996
Copy link

linen1996 commented May 22, 2020

I directly run cwebp.exe like this bat code, it works, but the JavaScript code webpConverter.cwebp(input, output, options, callback), it got error Error! Unknown option '-'.

:: bat code
D:\Workspaces\front-end\project\image2html\node_modules\webp-converter/lib/libwebp_win64/bin/cwebp.exe -q 75 "D:/Workspaces/front-end/project/image2html/images/4 - 28172-1565573276-704911963.png" -o "D:/Workspaces/front-end/project/image2html/images/imagemin/4 - 28172-1565573276-704911963.webp"
// JavaScript code
let imageDirPath = 'D:/Workspaces/front-end/project/image2html/images'
let imageminRelativeFolder = 'imagemin'

function getImageminDir (dirPath) {
  return `${imageDirPath}/${imageminRelativeFolder}`
}

function toWebp (file) {
  let input = `"${imageDirPath}/${file}"`
  let output = `"${getImageminDir()}/${util.replaceExtnameToWebp(file)}"`
  let options = `-q 75`
  let callback = function (status, error) {
    if (status == 101) {
      console.log('101, error)
    }
  }
  webpConverter.cwebp(input, output, options, callback)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant