shakacode / bootstrap-sass-loader

Webpack Loader for the Sass version Twitter Bootstrap
MIT License
118 stars 25 forks source link

Using the glyphicon set #12

Closed mrozbarry closed 9 years ago

mrozbarry commented 9 years ago

I'm firstly not sure if this is a problem with this loader, or I just have a poor grasp on webpack.

Here is my app configuration.

Do I need to use a special loader to get those font files working? I've been trying to figure this out for two days. I know I can do this the wrong way and just copy the font files into public/fonts, but I want to know the correct way to do this.

Any thoughts/ideas?

justin808 commented 9 years ago

You need a @font-face for custom fonts. I'm looking into the glyphicons. That should be working without doing anything special.

This is how I did this for a sass file used in both a Rails and Webpack Dev Server.

Full details here: https://github.com/justin808/react-webpack-rails-tutorial.

Note, the latests 3.x beta version of node sass is removing the image-url helper. I'm going to follow a similar strategy for that. I'm updating the example today.

Please confirm this fixes your issue and I'll close this issue.

// Define a custom font.
// Libsass, which is used by the webpack sass loader, does not support font-url()
// so we use url() instead. This is a known issue.
@font-face {
  font-family: 'OpenSans-Light';
   src: url('assets/fonts/OpenSans-Light.ttf') format('truetype');
}
justin808 commented 9 years ago

@mrozbarry I updated both https://github.com/justin808/bootstrap-sass-loader and https://github.com/justin808/bootstrap-sass-loader-example.

The example now shows

  1. glyphicons working.
  2. option for config.debug which shows the $icon-font-path

https://github.com/justin808/bootstrap-sass-loader/commit/fe46c43fb16a5db4817a511633ee684fbcac7403