Skip to content

How to instruct Angular CLI to NOT inline images less than 10Kb in size #8945

@oburakevych

Description

@oburakevych

Versions

Angular CLI: 1.6.0
Node: 8.9.0
OS: darwin x64
Angular: 5.0.0
... compiler, compiler-cli, core, service-worker

Repro steps

  • Make sure your app has assets, e.g. images of size less than 10Kb referenced from your css
  • run ng build --target=production

Observed behavior

Assets, e.g. images of size less than 10kb are inlined in CSS

Desired behavior

When building an Angular app with Angular CLI, resources in CSS, e.g. svg images, less than 10kb in size will be inlined.

This sounds like a good concept from the performance point of view, however, it violates very strict Content Security Policies in my app, which I 'm not allowed to change.

data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also inject arbitrary data: URIs. Use this sparingly and definitely not for scripts.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/img-src

I want an option to NOT to inline any assets, e.g. images, in CSS due to strict CSP requirements.

Mention any other details that might be useful (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions