1

I'm migrating a project to Angular 6 and I'm trying to import my css file in styles section on angular.json:

"styles": [
      "./src/styles.css",
      "./node_modules/primeng/resources/primeng.min.css",
      "./node_modules/primeicons/primeicons.css",
      "./node_modules/bootstrap/dist/css/bootstrap.min.css"
],
"scripts": [
      "./node_modules/jquery/dist/jquery.min.js",
      "./node_modules/popper.js/dist/umd/popper.min.js",
      "./node_modules/bootstrap/dist/js/bootstrap.min.js"
]

but it doesn't work. Css are correctly imported but class are not applied, except for class in style.css. Instead, it correctly work for js imported in scripts section. Any ideas? Thanks

The folder structure is:

app --
     |-- node_modules
     |-- src
       |.. styles.css
     |-- angular.json
6
  • can you post the hierarchy of your folder structure? Commented Dec 5, 2018 at 11:58
  • Thanks Ritesh, I edited the post. Commented Dec 5, 2018 at 12:17
  • Can you please try removing ./? Commented Dec 5, 2018 at 12:21
  • add like this ../node_modules/primeng/resources/primeng.min.css Commented Dec 5, 2018 at 12:24
  • You need to load styles.css at the last. In your case after bootstrap css Commented Dec 5, 2018 at 12:29

1 Answer 1

1

In my angular 6 app this is how I import css files:

"styles": [
          "node_modules/bootstrap/dist/css/bootstrap.css",
          "node_modules/font-awesome/css/font-awesome.css",
          "node_modules/pure-css-loader/dist/css-loader.css",
          "node_modules/primeng/resources/themes/omega/theme.css",
          "node_modules/primeng/resources/primeng.min.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.