似乎无法解析Javascript资产

似乎无法解析Javascript资产

本文介绍了Express.js和Zombie.js-似乎无法解析Javascript资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个Express.js应用,该应用使用connect-asssets来提供JS和CSS:

I have an Express.js app that uses connect-asssets to serve JS and CSS:

app.configure(function() {
    app.set('port', 3000);
    app.set('views', path.join(__dirname, 'views'));
    app.set('view engine', 'ejs');
    app.use(connectAssets({src: path.join(__dirname, 'assets')}));
});

我正在尝试使用 Zombie.js 进行验收测试,但是只要尝试使用SyntaxError: Unexpected token ILLEGAL解析Javascript文件.如果将connect-assets替换为express.static,那么验收测试就可以正常工作.

I'm trying to use Zombie.js for acceptance testing, but keep getting SyntaxError: Unexpected token ILLEGAL whenever it tries to parse a Javascript file. If I replace connect-assets with express.static, then the acceptance tests work perfectly.

任何想法connect-assets有什么不同之处会使Zombie.js崩溃吗?

Any idea what connect-assets does differently that would trip up Zombie.js?

推荐答案

所以我通过查尔斯运行了请求. Zombie发送请求标头Accept-Encoding: identity,但是connect-assets仍返回GZIP数据.

So I ran the requests through Charles. Zombie sends the request header Accept-Encoding: identity, but connect-assets returns GZIP data anyway.

在Github上提出了与connect-file-cache有关的问题,希望该问题解决后,一切都会正常运行.

I raised an issue with connect-file-cache on Github, hopefully everything will run fine once this is fixed.

这篇关于Express.js和Zombie.js-似乎无法解析Javascript资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 13:04