function resolveConfig(options) {
  if (options.preset) {
    return resolvePreset(options.preset);
  }

  /** @type {string | undefined} */
  let searchPath = process.cwd();
  let configPath = undefined;

  if (options.configFile) {
    searchPath = undefined;
    configPath = path.resolve(process.cwd(), options.configFile);
  }

  const configExplorer = lilconfigSync(cssnano, {
    searchPlaces: [
      'package.json',
      '.cssnanorc',
      '.cssnanorc.json',
      '.cssnanorc.yaml',
      '.cssnanorc.yml',
      '.cssnanorc.js',
      'cssnano.config.js',
    ],
    loaders: {
      '.yaml': (filepath, content) => yaml.parse(content),
      '.yml': (filepath, content) => yaml.parse(content),
    },
  });
  const config = configPath
    ? configExplorer.load(configPath)
    : configExplorer.search(searchPath);

  if (config === null) {
    return resolvePreset('default');
  }

  return resolvePreset(config.config.preset || config.config);
}
/**
 * cssnano will look for configuration firstly as options passed
 * directly to it, and failing this it will use lilconfig to
 * load an external file.

 * @param {Options} options
 */
cssnano will look for configuration firstly as options passed
directly to it, and failing this it will use lilconfig to
load an external file.

@param {Options} options
cssnano will look for configuration firstly as options passed directly to it and failing this it will use lilconfig to load an external file . @param { Options } options
function resolveConfig(options) {
  if (options.preset) {
    return resolvePreset(options.preset);
  }
  let searchPath = process.cwd();
  let configPath = undefined;
  if (options.configFile) {
    searchPath = undefined;
    configPath = path.resolve(process.cwd(), options.configFile);
  }
  const configExplorer = lilconfigSync(cssnano, {
    searchPlaces: [
      'package.json',
      '.cssnanorc',
      '.cssnanorc.json',
      '.cssnanorc.yaml',
      '.cssnanorc.yml',
      '.cssnanorc.js',
      'cssnano.config.js',
    ],
    loaders: {
      '.yaml': (filepath, content) => yaml.parse(content),
      '.yml': (filepath, content) => yaml.parse(content),
    },
  });
  const config = configPath
    ? configExplorer.load(configPath)
    : configExplorer.search(searchPath);
  if (config === null) {
    return resolvePreset('default');
  }
  return resolvePreset(config.config.preset || config.config);
}
function resolveConfig ( options ) { if ( options . preset ) { return resolvePreset ( options . preset ) ; } let searchPath = process . cwd ( ) ; let configPath = undefined ; if ( options . configFile ) { searchPath = undefined ; configPath = path . resolve ( process . cwd ( ) , options . configFile ) ; } const configExplorer = lilconfigSync ( cssnano , { searchPlaces : [ 'package.json' , '.cssnanorc' , '.cssnanorc.json' , '.cssnanorc.yaml' , '.cssnanorc.yml' , '.cssnanorc.js' , 'cssnano.config.js' , ] , loaders : { '.yaml' : ( filepath , content ) => yaml . parse ( content ) , '.yml' : ( filepath , content ) => yaml . parse ( content ) , } , } ) ; const config = configPath ? configExplorer . load ( configPath ) : configExplorer . search ( searchPath ) ; if ( config === null ) { return resolvePreset ( 'default' ) ; } return resolvePreset ( config . config . preset || config . config ) ; }
cssnano will look for configuration firstly as options passed
 directly to it, and failing this it will use lilconfig to
 load an external file.
cssnano will look for configuration firstly as options passed directly to it and failing this it will use lilconfig to load an external file .
/** @type {string | undefined} */