Jryl
Jryl

Reputation: 1156

Why aren't all my images showing?

I'm using Express.js with Jade and running into an issue. I've got 6 images but 2 of them won't show up on the page. I can go to local:3000/images/a.png and see them all but not see them on my page? This is some of my Jade HTML:

          .span4
            img(src='/images/a.png', class='img')
          .span4
            img(src='/images/b.png', class='img')
          .span4
            img(src='/images/c.png', class='img')
        .row-fluid
          .span4
            img(src='/images/d.png', class='img') 
          .span4
            img(scr='/images/e.png', class='img') # Not working
          .span4
            img(scr='/images/f.png', class='img') # Not working

Here is my app.js if it helps:

var express = require('express')
  , routes = require('./routes')
  , user = require('./routes/user')
  , http = require('http')
  , path = require('path');

var app = express();

// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon(__dirname + '/public/images/icon.ico'));
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));


// development only
if ('development' == app.get('env')) {
  app.use(express.errorHandler());
}

app.get('/', routes.index);
app.get('/users', user.list);

http.createServer(app).listen(app.get('port'), function(){
  console.log('Express server listening on port ' + app.get('port'));
});

Anyone else run into this? What could I do?

Upvotes: 0

Views: 180

Answers (1)

JAM
JAM

Reputation: 6195

Hehe, its because you have a typo in your jade file.

Double check your img tag - it's (as you know) supposed to be src not scr:

      .span4
        img(scr='/images/e.png', class='img') # Not working
      .span4
        img(scr='/images/f.png', class='img') # Not working

Upvotes: 4

Related Questions