question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to include css from installed npm package

See original GitHub issue

i have installed primeng, and fontawesome now i want add import css as below

"styles": [
  "../node_modules/font-awesome/css/font-awesome.min.css",
  "../node_modules/primeng/resources/themes/omega/theme.css",
  "../node_modules/primeng/resources/primeng.min.css",
  //...
]
```,

how to do this ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
danielpdevcommented, May 12, 2018

@jmdmao I’ve forked your app and this is the working version: https://strike-km4jfe.stackblitz.io/candidatos

The problem was in your styles.scss and angular.json, this is styles.scss: @import 'app/_variables'; @import '~bootstrap/scss/bootstrap'; @import '~font-awesome/scss/font-awesome';

@import 'app/_variables'; // Always use relative paths because you never know where your app will be running. @import '~font-awesome/scss/font-awesome'; //Using ~ will make sass look into node_module.

For angular.json just remove any trace of : "node_modules/font-awesome/scss/font-awesome.scss"

Hope that helps and have fun building your app! 👍

0reactions
danielpdevcommented, May 13, 2018

@jmdmao Add $fa-font-path: "node_modules/font-awesome/fonts" !default; to your styles.scss

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to export and import style in npm package? - Stack Overflow
For webpack, do npm install --save-dev css-loader . Then in your webpack.config.js, add this line to the use options: css-loader . Check out ......
Read more >
Create your own css npm module and use it in your project
First create your npm module ( https://medium.com/@jerrythimothy/create-your-own-npm-module-adf44126d1bd ) and when it asks for main file, give index.css.
Read more >
import-css - npm
import -css. NPM version. Load CSS asynchronously without render blocking in the given order. Install. npm ...
Read more >
importing CSS from a npm package - Notion
the 3 easy steps · find the name of the package and add it to your project. In this example it is normalize.css...
Read more >
1.3 how to import css from npm package? - Meteor forums
An alternative to copying the css file, is creating a symbolic link from somewhere in your meteor project, to the css file in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found