pack method

void pack()

Packs the set of files located under resourceRoot Each resources is packed into a separate dart library and placed in the generatedRoot directory.

A registry file will be generated in generated/resource_registry.g.dart which you can include to unpack the files onto the production system.

Implementation

void pack() {
  /// clear out an old generated files
  /// as we use UUIDs if we didn't do this the
  /// directory would keep growing.
  if (exists(generatedRoot)) {
    deleteDir(generatedRoot);
  }
  createDir(generatedRoot, recursive: true);
  var resources = <String>[];

  if (exists(resourceRoot)) {
    resources = find('*', workingDirectory: resourceRoot).toList();
  }

  final packedResources = _packResources(resources);
  _checkForDuplicates(packedResources);
  print(' - generating registry');
  _writeRegistry(packedResources);
  print(green('Pack complete'));
}