小编jdl*_*dlm的帖子

Flexbox容器中的省略号

自从Firefox Nightly(35.0a1)的最新版本(?)发布以来,我一直遇到text-overflow: ellipsis一个Flexbox容器内部的问题flex-direction: row,每列的宽度为50%.

演示:

.container {
  width: 300px;
  background: red;
}

.row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.column {
  flex-basis: 50%;
}

.column p {
  background: gold;
  
  /* Will not work in Firefox Nightly 35.0a1 */
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)
<div class="container">
  <div class="row">
    <div class="column">
      <p>Captain's Log, Stardate 9529.1: This is the final cruise of the starship Enterprise under my command. This ship and her history will shortly …
Run Code Online (Sandbox Code Playgroud)

css firefox

55
推荐指数
1
解决办法
5万
查看次数

Nginx只显示欢迎页面

我正在尝试设置一个简单的虚拟主机,只提供静态文件.麻烦的是,指导浏览器(在这种情况下)jorum.dev显示默认的nginx欢迎页面,而不是jorum.dev/index.html.

Nginx是在Mac OS X Mountain Lion上使用Homebrew安装的.

主机

127.0.0.1       jorum.dev
Run Code Online (Sandbox Code Playgroud)

jorum.dev

server {
    listen          80;
    server_name     jorum.dev;

    location / {
        root        ~/Sites/jorum;
        index       index.html index.htm;
    }
}
Run Code Online (Sandbox Code Playgroud)

nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    gzip            on;
    gzip_disable    "msie6";
    gzip_min_length 1100;
    gzip_vary       on;
    gzip_proxied    any;
    gzip_buffers    16 8k;
    gzip_types      text/plain text/css application/json application/x-javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/x-font-ttf font/opentype application/vnd.ms-fontobject;

    server_tokens off;

    client_max_body_size    4096k;
    client_header_timeout   10;
    client_body_timeout     10; …
Run Code Online (Sandbox Code Playgroud)

nginx

25
推荐指数
4
解决办法
4万
查看次数

Sublime Text 3 SublimeLinter插件无法找到jshint

出于某种原因,SublimeLinter3或SublimeLinter3 JSHint linter插件似乎无法解析PATH环境变量,因此无法运行jshint:

SublimeLinter: Could not parse shell PATH output:
<empty> 
error: SublimeLinter could not determine your shell PATH. It is unlikely that any linters  will work. 

Please see the troubleshooting guide for info on how to debug PATH problems.
SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint' 
Can't connect
Unable to fetch update url contents
Run Code Online (Sandbox Code Playgroud)

然而,jshint二进制文件在PATH:

$ which jshint
/home/path/to/bin/jshint
Run Code Online (Sandbox Code Playgroud)

问题只发生在Ubuntu上.在OS X上完美运行.我通过官方文档搜索无济于事.

使用,bash如果有任何后果.

jshint sublimelinter sublimetext3

10
推荐指数
2
解决办法
1万
查看次数

RequestAnimationFrame的RangeError

我收到以下错误:

RangeError: Maximum call stack size exceeded.
Run Code Online (Sandbox Code Playgroud)

在这一行:

requestAnimFrame(Game.loop());
Run Code Online (Sandbox Code Playgroud)

在这段代码中:

var Game = {
  canvas: null,
  context: null,
  targetFps: 60,

  init: function() {
    canvas = document.getElementById('main-canvas');
    context = canvas.getContext('2d');

    // Resize canvas to match content
    var content = document.getElementById('primary-content');
    canvas.width = content.offsetWidth;
    canvas.height = content.offsetHeight;

    window.requestAnimFrame = (function() {
      return window.requestAnimationFrame || // Chromium
        window.webkitRequestAnimationFrame || // WebKit
        window.mozRequestAnimationFrame || // Mozilla
        window.oRequestAnimationFrame || // Opera
        window.msRequestAnimationFrame || // IE
        null;
    })();

    this.loop();
  },

  loop: function() {
    requestAnimFrame(Game.loop());
  },

  update: …
Run Code Online (Sandbox Code Playgroud)

html javascript canvas

5
推荐指数
1
解决办法
3692
查看次数

Webpack 动态导入中的字符串文字

我使用动态导入来创建项目中所有语言环境的块。块已创建,但客户端在运行时报告此错误:

Uncaught (in promise) ReferenceError: locale is not defined
  at _callee$ (main.js?f161:72)
  at tryCatch (runtime.js?98b8:62)
  at Generator.invoke [as _invoke] (runtime.js?98b8:288)
  at Generator.prototype.(:8082/d2/v2/search/anonymous function) [as next] (webpack-internal:///./node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:114:21)
  at asyncGeneratorStep (asyncToGenerator.js?c973:3)
  at _next (asyncToGenerator.js?c973:25)
Run Code Online (Sandbox Code Playgroud)

有问题的代码:

Uncaught (in promise) ReferenceError: locale is not defined
  at _callee$ (main.js?f161:72)
  at tryCatch (runtime.js?98b8:62)
  at Generator.invoke [as _invoke] (runtime.js?98b8:288)
  at Generator.prototype.(:8082/d2/v2/search/anonymous function) [as next] (webpack-internal:///./node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:114:21)
  at asyncGeneratorStep (asyncToGenerator.js?c973:3)
  at _next (asyncToGenerator.js?c973:25)
Run Code Online (Sandbox Code Playgroud)

巴贝尔配置:

"babel": {
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    [
      "@babel/plugin-proposal-object-rest-spread",
      {
        "useBuiltIns": true
      }
    ], …
Run Code Online (Sandbox Code Playgroud)

dynamic-import webpack babeljs

5
推荐指数
0
解决办法
1011
查看次数

使用 nuxtServerInit 时缓存的访问令牌

使用 Nuxt 时,我遇到了与授权 (JWT) 相关的缓存问题。

这是nuxtServerInit我设置访问令牌的操作:

// store/index.js

import cookie from 'cookie';

export const state = () => ({
  authCookie: 'MyAuthCookie',
});

export const actions = {
  async nuxtServerInit({ dispatch, commit, state }, { req }) {
    // Check for access token
    const accessToken = req.headers.cookie &&
      cookie.parse(req.headers.cookie)[state.authCookie];

    // Set the access token, if there is one
    if (accessToken) {
      commit('auth/setAccessToken', accessToken);
    }
  },
};
Run Code Online (Sandbox Code Playgroud)

accessToken状态稍后用于设置Authorization此插件中所有未来请求的标头:

// plugins/axios.js

export default function ({ app, store …
Run Code Online (Sandbox Code Playgroud)

akamai nuxt.js

5
推荐指数
1
解决办法
597
查看次数