在index.jade

时间:2017-01-22 12:21:56

标签: javascript reactjs pug video.js

我想在index.jade文件中包含js文件的脚本。目前我添加了它们,但事情似乎并没有反映在UI上。我添加了本地存储在我的目录中的markers.js脚本。这是我的项目结构

enter image description here

这是我的index.jade文件的head_script部分

block head_scripts
    script(src="https://code.jquery.com/jquery-2.0.3.min.js")
    script(src='https://vjs.zencdn.net/5.3.0/video.js')
    link(href="https://vjs.zencdn.net/5.3.0/video-js.css" rel="stylesheet")
    script(src='https://vjs.zencdn.net/ie8/1.1.0/videojs-ie8.min.js')
    script(src='../client/pages/VideoScreen/markers.js')
    link(href='../client/pages/VideoScreen/marker.css' rel="stylesheet")

这是我的服务器文件

var debug  = require('debug')('tessact:node');
var app = express();


const IS_PROD = (process.env.NODE_ENV === "production");
const PORT = (process.env.PORT || 4200);

var routes = require('./routes').default;

if (app.get('env') === 'development') {
  app.locals.pretty = true;
}
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

app.set('env', IS_PROD ? 'production' : 'development');
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(compression());
app.use('/public', express.static(
  path.resolve(__dirname, './public')
));

app.use('/', routes());
// catch 404 and forward to error handler
app.use(function(req, res, next) {
  var err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// error handlers


// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: err
    });
  });
}


// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});

const runServer = (app)=> {
  app.listen(PORT, ()=> {
    debug(`Listening on http://localhost:${PORT}`); 
    if (__DEV__)
      debug(`HMR on http://localhost:${config.BS_PORT}`);
  });  
}


runServer(app);

module.exports = 

应用程序;

我添加的路径是否正确?我包含了脚本,但标记根本没有出现。这意味着代码不使用markers.js脚本。有人可以建议我一个解决方案吗?

0 个答案:

没有答案