0

I've made an Angular library that I'm importing into an outside project. The styles I created in the original project however are not showing up when I use the library in the outside project.

Here's the layout of my project:

-> my-lib
   -> src
      -> lib
         -> components
         -> models
         -> services
         -> styles
             -> my_styles.css

In my angular.json file for this project, I've included the .css file in the styles section like:

"styles": [
   "src/lib/styles/my_styles.css"
]

After I package the project into a custom library, I import it into the outside project:

"my-lib": "file:my-lib-1.0.0.tgz"

In the outside project's angular.json within the main project I include the style sheet in the 'styles' section similar to how I did the original project:

"styles": [
   "node_modules/my-lib/styles/my_styles.css"
]

When I run this project however, the styles aren't being applied. What exactly am I doing wrong?

2
  • 1
    If you check my-lib folder in node_modules in outside project, do you have the styles folder there ? Commented Mar 23, 2020 at 22:50
  • @RomanŠimík yes, the 'styles' folder is there. Commented Mar 23, 2020 at 22:54

1 Answer 1

1

simply you can add your file my_styles.css in assests folder and call it in style.css like this

@import url('./assets/my_styles.css');

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.