1
votes

I'm trying to use glyphicons (via bootstrap) in my Express app. The problem is when I'm serving my static files, the glyphicons aren't included.

This is my directory (created by grunt):

Build

   fonts
       glyphicons-halflings.eot
       ...

   js
       scripts.js

   stylesheets
       styles.css

Here is my app.js code:

app.use('/build/', express.static(path.join(__dirname, 'build/js')));
app.use('/build/', express.static(path.join(__dirname, 'build/stylesheets')));
app.use(express.static(path.join(__dirname, 'build/fonts')));

Here is the error from chrome:

users:1 GET http://localhost:3000/fonts/glyphicons-halflings-regular.woff 404 (Not Found) users:1 GET http://localhost:3000/fonts/glyphicons-halflings-regular.ttf 404 (Not Found)

I've tried switching to

app.use('/build/', express.static(path.join(__dirname, 'build/fonts')));

but I'm pretty sure bootstrap is looking for ../fonts, so the dir can't be quite the same. In other words, bootstrap is expecting a structure like so:

js/bootstrap.js
fonts/glyphs

Where am I off?

Thanks everyone!

1

1 Answers

4
votes

Just use the following then:

app.use('/fonts/', express.static(path.join(__dirname, 'build/fonts')));