Contexts.parse constructor

Contexts.parse(dynamic options)

Copy from options LessOptions or Contexts

parse is used whilst parsing

Implementation

//2.2.0 TODO
Contexts.parse(dynamic options) {
  if (options == null) return;

  parseCopyProperties(options);

  contents ??= <String, String>{};
  contentsIgnoredChars ??= <String, int>{};
  files ??= <String, Node>{};

  if (currentFileInfo == null) {
    final String filename =
        (options.filename?.isNotEmpty ?? false) ? options.filename : 'input';
    final String entryPath = filename.replaceAll(RegExp(r'[^\/\\]*$'), '');
    options.filename = null;

    currentFileInfo = FileInfo()
      ..filename = filename
      ..rewriteUrls = rewriteUrls
      ..rootpath = options.rootpath ?? ''
      ..currentDirectory = entryPath
      ..entryPath = entryPath
      ..rootFilename = filename;
  }

//2.2.0
//  contexts.Parse = function(options) {
//      copyFromOriginal(options, this, parseCopyProperties);
//
//      if (typeof this.paths === "string") { this.paths = [this.paths]; }
//  };
}