gowravshekar/font-awesome-webpack

How to rename the font files.

zackyang000 opened this issue · 4 comments

I try to rename the font files, but failed. It can't to load when I running server. Even it's not send any request for font files.

my config like this:

  module: {
    loaders: [
      ...
      { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&name=fonts/[hash:6].[ext]&mimetype=application/font-woff' },
      { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&name=fonts/[hash:6].[ext]&mimetype=application/font-woff' },
      { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&name=fonts/[hash:6].[ext]&mimetype=application/octet-stream' },
      { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&name=fonts/[hash:6].[ext]&mimetype=image/svg+xml' },
      { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file' }
    ]
  }

Font files are loaded automatically when you include the entry point enclosing require('font-awesome-webpack!configDir/font-awesome.config.js'); in your html page. Where are you requiring font-awesome ?

Sorry, I mean, after wepack bundle, I will get build dir like this:

build/index.js
build/4b5a84aaf1c9485e060c503a0ff8cadb.woff2
build/7c87870ab40d63cfb8870c1f183f9939.ttf
build/45c73723862c6fc5eb3d6961db2d71fb.eot
build/76a4f23c6be74fd309e0d0fd2c27a5de.svg
build/dfb02f8f6d0cedc009ee5887cc68f1f3.woff

But I hope get this:

build/index.js
build/font/4b5a84.woff2
build/font/7c8787.ttf
build/font/45c737.eot
build/font/76a4f2.svg
build/font/dfb02f.woff

I try to edit webpack config like I said above, unfortunately, it's not work.

I tested your configuration and it works fine. You need to pass name query string to file loader also for eot extension. Are you using the latest version of file and url loader? Can you post your package.json?

It's weird.

I try it just now and it works well. Maybe I upgrade file-loader and url-loader few days age.

Anyway, thanks for your reply.