clean-css-cli icon indicating copy to clipboard operation
clean-css-cli copied to clipboard

Not work cleancss -O0 less.css

Open cooliean opened this issue 3 years ago • 1 comments

this is a bug

  options = {
    batch: inputOptions.batch,
    compatibility: inputOptions.compatibility,
    format: inputOptions.format,
    inline: typeof inputOptions.inline == 'string' ? inputOptions.inline : 'local',
    inlineTimeout: inputOptions.inlineTimeout * 1000,
    level: { 1: true },
    output: inputOptions.output,
    rebase: inputOptions.withRebase ? true : false,
    rebaseTo: undefined,
    sourceMap: inputOptions.sourceMap,
    sourceMapInlineSources: inputOptions.sourceMapInlineSources
  };

  if (program.rawArgs.indexOf('-O0') > -1) {
    options.level[0] = true;
  }

  if (program.rawArgs.indexOf('-O1') > -1) {
    options.level[1] = findArgumentTo('-O1', program.rawArgs, program.args);
  }

if use level -O0 level: { 1: true }, options.level[1] is always true

  if (program.rawArgs.indexOf('-O1') > -1) {
    options.level[1] = findArgumentTo('-O1', program.rawArgs, program.args);
  }else{
    options.level[1] = false;
  }

cooliean avatar Jun 19 '22 12:06 cooliean

Hey @cooliean, you are 100% right. Would you mind turning this change into a PR?

jakubpawlowicz avatar Jun 22 '22 08:06 jakubpawlowicz