Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add How-To load Font Awesome from NPM #1118

Closed
hongbo-miao opened this issue Oct 20, 2016 · 7 comments
Closed

add How-To load Font Awesome from NPM #1118

hongbo-miao opened this issue Oct 20, 2016 · 7 comments
Assignees

Comments

@hongbo-miao
Copy link
Contributor

hongbo-miao commented Oct 20, 2016

@hongbo-miao hongbo-miao changed the title How-To for loading Font Awesome from NPM add How-To load Font Awesome from NPM Oct 20, 2016
@rafaelss95
Copy link
Contributor

@sdemurjian can you explain it? Actually I'm not able to import font-awesome.

@rafaelss95
Copy link
Contributor

rafaelss95 commented Nov 21, 2016

First of all thanks for your reply.

I did what you said, however I'm still getting the following error:

GET http://localhost:3000/assets/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0
GET http://localhost:3000/assets/font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0
GET http://localhost:3000/assets/font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0

head-config.commonjs:

    ...
    /** <link> tags for a Web App Manifest **/
    { rel: 'manifest', href: '/assets/manifest.json' },
    { rel: 'stylesheet', href: '/assets/font-awesome/css/font-awesome.min.css' }

webpack.common.js:

      new CopyWebpackPlugin([
        { from: 'src/assets', to: 'assets' },
        { from: 'src/meta'},
        { 
          from: 'node_modules/font-awesome/css/font-awesome.min.css',
          to: 'assets/font-awesome/css/font-awesome.min.css'
        }
      ]),

By the way I can see font-awesome imported in Chrome Dev Tools.

@gilhanan
Copy link
Contributor

@rafaelss95 notice that you have to stop and start server for apply changes

@rafaelss95
Copy link
Contributor

@gilhanan Yes, I did.

@RaphaelYan
Copy link
Contributor

You have to copy font files too

@rafaelss95
Copy link
Contributor

Thank you all guys, I copied the fonts as @RaphaelYan said and now it's working.

  new CopyWebpackPlugin([
    { from: 'src/assets', to: 'assets' },
    { from: 'src/meta'},
    {
      from: 'node_modules/font-awesome/css/font-awesome.min.css',
      to: 'assets/font-awesome/css/font-awesome.min.css'
    },
    {
      from: 'node_modules/font-awesome/fonts',
      to: 'assets/font-awesome/fonts'
    }
  ]),

@andrewlorenz
Copy link

I have to laugh reading this - first @sdemurjian says "It's as simple as adding an element ...", then after someone else has struggled with his solution that doesn't work, and identifies all the steps required, he comes back with "Oops, yes was missing fonts" !!! LOL. I think this thread proves the very point of the original issue - that it needs (better) documenting ! To be honest its a lot messier to use the module than I expected - as in a lot of additional work over and above the initial npm install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants