npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@o3r/dynamic-content

v15.3.3

Published

This module provides a mechanism to retrieve media and data depending on the host or a server specific url.

Readme

This package is an Otter Framework Module.

Description

Stable Version Bundle Size

This module provides a mechanism to retrieve media and data depending on the host or a server-specific url.

How to install

ng add @o3r/dynamic-content

[!WARNING] This module requires @o3r/core to be installed.

Description

In order to get your content from a different location than where your application is hosted, you may use the O3rDynamicContentPipe or DynamicContentService from @o3r/dynamic-content.

O3rDynamicContentPipe

import {O3rDynamicContentPipe} from '@o3r/dynamic-content';

@Component({
  ...
  imports: [O3rDynamicContentPipe, ...]
})
export class MyComponent {}
<img src="{{'assets-otter/imgs/logo.png' | o3rDynamicContent}}" /> or
<img [src]="'assets-otter/imgs/logo.png' | o3rDynamicContent" />

DynamicContentService


@Component({
  /* ... */
})
export class MyComponent {
  public readonly imgSrc = inject(DynamicContentService).getMediaPath('assets/assets-otter/imgs/logo.png');
}
<img [src]="imgSrc" />

In both examples above, the result will be the same.

Content base path

By default, both the service and the pipe will concatenate the assets path with a root path injected in the application. By default, the application will try to find the value of the data tag data-dynamiccontentpath in the body. Example:

<body data-dynamiccontentpath="/cdn/myApp/">
</body>

If no tag is present, it defaults to empty string ''.

In order to change the default behavior, you can specify a configuration:

import {provideDynamicContent, withBasePath} from '@o3r/dynamic-content';

export const appConfig: ApplicationConfig = {
  providers: [
    // ...
    provideDynamicContent(withBasePath('a-different-path/'))
  ]
};

If you need an external dependency to get the rootpath, you may use need to provide a function.

import {provideDynamicContent, withBasePath} from '@o3r/dynamic-content';

export function myContentPath() {
  return 'a-different-path/';
}


export const appConfig: ApplicationConfig = {
  providers: [
    // ...
    provideDynamicContent(withBasePath(myContentPath))
  ]
};

getContentPathStream

For non-media resources (ex: localization, configuration) one should refer to the getContentPath method of the DynamicContentService. Doing so will ensure the correct resource path is computed in any environment (e.g. when the data-dynamiccontentpath tag is present in the body).

The content path is always related to the root of the application. It also ignores any path overrides from the AssetPathOverrideStore store, meaning that you will always get the same file.

import {from, type Observable} from 'rxjs';
import {shareReplay, switchMap} from 'rxjs/operators';

@Component({
  /** */
})
export class MyComponent {
  public dynamicConfig$: Observable<Response> = inject(DynamicContentService).getContentPathStream('global.config.post.json').pipe(
    switchMap((filePath) => from(fetch(filePath))),
    shareReplay({ bufferSize: 1, refCount: true })
  );
}

getMediaPathStream

This method allows to access all media resources: meaning any resource that is INSIDE the media folder. The assets path needs to be relative to the media folder. Example:

@Component({
  /** */
})
export class MyComponent {
  private readonly dynamicContentService = inject(DynamicContentService);

  async getDynamicConfig() {
    const filePath = await firstValueFrom(this.service.getMediaPathStream('imgs/my-image.png'));
    const fileContent = await fetch(filePath);
    //  ...
  }
}

It also looks for overrides in the AssetPathOverrideStore, so it will return the new value instead if an override is found.

AssetPathOverrideStore

A dedicated store is available in case you want to override any media path. This store contains a mapping between the current file path and the one that should be used instead.

This override ONLY WORKS for media resources.