How to use the @angular-devkit/build-angular/src/utils/normalize-asset-patterns.normalizeAssetPatterns function in @angular-devkit/build-angular

To help you get started, we’ve selected a few @angular-devkit/build-angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enten / udk / angular / lib / build / ng-devkit.ts View on Github external
`Localized bundle generation ${hasErrors ? 'failed' : 'complete'}.`,
            );

            if (hasErrors) {
              return finalize(false);
            }
          }
        } finally {
          executor.stop();
        }

        // Copy assets
        if (options.assets) {
          try {
            await copyAssets(
              normalizeAssetPatterns(
                options.assets,
                new virtualFs.SyncDelegateHost(host),
                root,
                normalize(projectRoot),
                projectSourceRoot === undefined ? undefined : normalize(projectSourceRoot),
              ),
              Array.from(outputPaths.values()),
              context.workspaceRoot,
            );
          } catch (err) {
            context.logger.error('Unable to copy assets: ' + err.message);

            return finalize(false);
          }
        }
github shlomiassaf / ngrid / tools / ng-packagr.transformers / sass-build-task.ts View on Github external
async function sassCompileTask(context: EntryPointTaskContext) {
  const globalContext = context.context();
  if (context.epNode.data.entryPoint.isSecondaryEntryPoint) {
    return;
  }

  const { builderContext, workspace, root, projectRoot, sourceRoot, options } = globalContext;
  const host = new virtualFs.AliasHost(workspace.host as virtualFs.Host);
  const syncHost = new virtualFs.SyncDelegateHost(host);

  if (!options.tasks.data.sassCompile) {
    return;
  }

  const assets = normalizeAssetPatterns(
    options.tasks.data.sassCompile.entries,
    syncHost as any,
    root,
    projectRoot,
    sourceRoot,
  );

  const copyPatterns = buildCopyPatterns(root, assets);
  log.info('Compiling sass bundles...');

  const destPath = Path.join(root, copyPatterns[0].to);

  const taskName = context.epNode.data.entryPoint.moduleId + ':css';
  task(taskName, () => {
    return buildScssPipeline(copyPatterns[0].context, [ Path.join(root, 'node_modules/') ], true).pipe(dest(destPath));
  });
github shlomiassaf / ngrid / tools / ng-packagr.transformers / sass-build-task.ts View on Github external
async function sassBundleTask(context: EntryPointTaskContext) {

  const globalContext = context.context();
  if (context.epNode.data.entryPoint.isSecondaryEntryPoint) {
    return;
  }

  const { builderContext, workspace, root, projectRoot, sourceRoot, options } = globalContext;
  const host = new virtualFs.AliasHost(workspace.host as virtualFs.Host);
  const syncHost = new virtualFs.SyncDelegateHost(host);

  if (!options.tasks.data.sassBundle) {
    return;
  }

  const assets = normalizeAssetPatterns(
    options.tasks.data.sassBundle.entries,
    syncHost as any,
    root,
    projectRoot,
    sourceRoot,
  );

  const copyPatterns = buildCopyPatterns(root, assets);
  const copyOptions = { ignore: ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'] };

  log.info('Bundling a sass bundles...');

  const promises = copyPatterns.map( pattern => {
    const fullPattern = pattern.context + pattern.from.glob;
    const opts = { ...copyOptions, dot: pattern.from.dot };
    return globby(fullPattern, opts)

@angular-devkit/build-angular

Angular Webpack Build Facade

MIT
Latest version published 8 days ago

Package Health Score

94 / 100
Full package analysis

Popular @angular-devkit/build-angular functions