糟糕的选择:'; _;' 在构建Twitter Bootstrap时

Pao*_*olo 7 customization compilation jshint twitter-bootstrap

我刚刚安装并配置了环境,以在本地构建自定义版本的Twitter Bootstrap.

这就是我做的:

  1. 安装节点
  2. 安装npm
  3. 少安装
  4. 克隆Bootstrap本地
  5. 运行make build以编译Bootstrap

第5步:

~/devel/parking/bootstrap$ make build
jshint js/*.js --config js/.jshintrc

js/bootstrap-affix.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-alert.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-button.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-carousel.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-collapse.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-dropdown.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-modal.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-popover.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-scrollspy.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-tab.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-tooltip.js: line 24, col 17, Bad option: ';_;'.
js/bootstrap-transition.js: line 23, col 17, Bad option: ';_;'.
js/bootstrap-typeahead.js: line 23, col 17, Bad option: ';_;'.

13 errors
make: *** [test] Error 2
Run Code Online (Sandbox Code Playgroud)

第23行:

"use strict"; // jshint ;_;
Run Code Online (Sandbox Code Playgroud)

我能够解决// jshint ;_;从第23行删除的问题.虽然,我宁愿保持Bootstrap源不受影响.

如何摆脱这些错误以及"错误选项"错误的含义是什么?


JS/.jshintrc:

{
    "validthis": true,
    "laxcomma" : true,
    "laxbreak" : true,
    "browser"  : true,
    "eqnull"   : true,
    "debug"    : true,
    "devel"    : true,
    "boss"     : true,
    "expr"     : true,
    "asi"      : true
}
Run Code Online (Sandbox Code Playgroud)

Dyl*_*ade 17

今天的问题是JSHint的最新版本与当前的Bootstrap Makefile不兼容,因为之前的静默警告现在会抛出错误.

删除JSHint npm uninstall jshint,然后安装0.9.1版npm install jshint@0.9.1.最后运行make并成功编译.

  • 您还需要正确版本的uglify:https://groups.google.com/forum/?fromgroups =#!topic/twitter-bootstrap/cfy3J0nhfwM (4认同)
  • npm install uglify-js @ 1 (3认同)

小智 4

我刚才遇到了同样的错误,在搜索了 bootstrap 问题后,

我找到了解决方案,请查看这些: https: //github.com/twitter/bootstrap/pull/5244 https://github.com/twitter/bootstrap/issues/7043

  • 您能否将该链接中的一些详细信息添加到您的答案中?如果/当链接消失时,仅链接的答案就没那么有用。 (2认同)