Created
          February 15, 2015 04:05 
        
      - 
            
      
        
      
    Star
      
          
          (147)
      
  
You must be signed in to star a gist  - 
              
      
        
      
    Fork
      
          
          (19)
      
  
You must be signed in to fork a gist  
- 
      
 - 
        
Save Turbo87/e8e941e68308d3b40ef6 to your computer and use it in GitHub Desktop.  
    webpack + font-awesome test
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require('font-awesome/css/font-awesome.css'); | |
| document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>'; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | |
| <title>Webpack Test</title> | |
| </head> | |
| <body> | |
| <script src="bundle.js"></script> | |
| </body> | |
| </html> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "name": "webpack-font-awesome-test", | |
| "version": "1.0.0", | |
| "author": "Tobias Bieniek <[email protected]>", | |
| "scripts": { | |
| "dev": "webpack -d", | |
| "dist": "webpack -p" | |
| }, | |
| "dependencies": { | |
| "font-awesome": "^4.3.0" | |
| }, | |
| "devDependencies": { | |
| "css-loader": "^0.9.1", | |
| "file-loader": "^0.8.1", | |
| "style-loader": "^0.8.3", | |
| "url-loader": "^0.5.5", | |
| "webpack": "^1.5.3" | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var config = { | |
| entry: './app.js', | |
| output: { | |
| filename: 'bundle.js' | |
| }, | |
| module: { | |
| loaders: [{ | |
| test: /\.css$/, | |
| loader: 'style!css?sourceMap' | |
| }, { | |
| test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, | |
| loader: "url?limit=10000&mimetype=application/font-woff" | |
| }, { | |
| test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, | |
| loader: "url?limit=10000&mimetype=application/font-woff" | |
| }, { | |
| test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | |
| loader: "url?limit=10000&mimetype=application/octet-stream" | |
| }, { | |
| test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | |
| loader: "file" | |
| }, { | |
| test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | |
| loader: "url?limit=10000&mimetype=image/svg+xml" | |
| }] | |
| } | |
| }; | |
| module.exports = config; | 
I manage to run webpack while requiring the font-awesome css file (now you also need to add "-loader" to loader names in the webpack.config); but I get 404 on the icons, which just show up as sad little squares where invoked in the html.
@jaimefps same as you, did you solved?
works, thank you
I prefer the official way to do it as detailed in the fontawesome docs
This works. font-awesome-webpack did not
Do I have to deploy the .woff, .eot, .woff2, .svg files along with the bundle.js?
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
This was really helpful. If you are using css modules and this is not working, then have a look at
https://gist.github.com/sandor11/0319e27d0ef43637ff399ec303fa116f