Skip to content

feat(webpack): Support to add custom/third party css/sccs #1459

Closed
@sirajc

Description

@sirajc

Version/OS Information:

  1. Windows 7
  2. ng --version.
    angular-cli: local (v1.0.0-beta.10, branch: master)
    node: 4.4.7
    os: win32 x64
  1. Repro steps.
    This is CLI App. Have few css files/third party css that needs to be included in the app
import './assets/vendor/paper/bootstrap.min.css';
import './assets/vendor/hint.min.css';

Having above in polyfill.ts or main.ts has no effect, css are not included at all

As a workaround for now, I have included this in index.html

<link rel="stylesheet" href="assets/vendor/paper/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="assets/vendor/hint.min.css" media="screen">

This works fine, but we loose webpack features in this.

Expectation: webpack starters support including css using import, It is expected that cli supports the same behaviour

Important:
I also have app.scss which is common styles for app, due this limitation I cannot include it, for now as a workaround, I have added this in app.component as below

  styleUrls: ['app.component.scss'],
  encapsulation: ViewEncapsulation.None

This way I have app.scss available for whole app, but this is clearly a hack

PS: No error in logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfulfeatureIssue 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