Skip to content

Sass file import in every component creating duplicate copies of sass file data on run time #8431

Closed
@amareshteja

Description

@amareshteja

I'm trying to use Sass with angular 4. like this,
@import "~assets/css/svg-icons";

Everything works fine. But the problem is, I've to import same sass file in every component individually (In both parent and child components).
So on compile time angular-cli injecting complete content of svg-icons.scss file, in every component with some attribute appended to all the classes of that file, like .view-icon[_ngcontent-c1], .view-icon[_ngcontent-c2].

So, If there is 100 lines of code in svg-icons.scss, and If I import it in 10 components, It'll be 1000 lines of duplicated code, which will be injected to index.html, on run time. I don't want this duplication of code as this increases the size of the file exponentially. How can I resolve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions