小编Jon*_*Sud的帖子

如何使用 vuetify 使字体大小响应?

vuetify他们有排版的帮助类。

例如,.display-4商品为h1这里是完整列表

当我为某些元素选择 display-1 时,在所有分辨率下,该类都会获得相同的字体大小 (34px)。

我期待:

  • .display-4 屏幕宽度为 1024 像素时,字体大小为 34 像素。
  • .display-4 屏幕宽度为 300 像素时,字体大小为 18 像素。

据此我有两个问题,为什么会这样?以及如何使用 vuetify 使我的字体大小元素具有响应性?

vue.js vuetify.js

3
推荐指数
2
解决办法
9912
查看次数

如何使用 hygen 生成模板后运行脚本?

我正在使用hygen为我的项目创建模板。

如何在hygen命令以hygen 方式完成后运行脚本(nodejs) ?

hygen my-package new awsome-package
Run Code Online (Sandbox Code Playgroud)

例如,在这个命令之后,我想tsconfig.json在当前项目中添加行。

javascript node.js

3
推荐指数
1
解决办法
1580
查看次数

如何用动画将元素从一个点移动到另一个点?

我有一个绝对位置的div。我想将其从一个点移动到另一点,例如从 (50,50) 移动到 (400,500)。每次我单击按钮移动元素时,点都会发生变化。我想使用动画进行过渡。

在一般解决方案中如何做到这一点或者是否有 npm 包可以做到这一点?

javascript css

3
推荐指数
1
解决办法
8427
查看次数

开始播放视频时如何向videojs添加事件侦听器?

如何在视频开始播放时向 videojs 添加事件侦听器?(这个事件应该是在乞讨时调用)?

我搜索了Player Events 文档,但找不到任何告诉我“现在视频开始播放”的事件。

javascript video.js

3
推荐指数
1
解决办法
7295
查看次数

我是否需要在 AWS ECS 中使用带有 nginx 的 AWS 负载均衡器?

我在 AWS ECS 中使用 Docker。我有一台 EC2 机器,带有 AWS ECS 的 docker 代理,ECS 任务包含 3 个容器:

  • Nginx 容器
  • 应用程序-nodejs容器
  • staticfiles-nodejs-应用程序容器。

我想支持非常巨大的流量。我需要设置AWS负载均衡器吗?或者我对nginx上游的设置就足够了?

nginx 配置示例:

upstream appwww {                                                                                            
    server app-www:3000;                                                                                     
}                                                                                                             

server {                                                                                                      
    server_name  my.home.net;                                                                       

     location / {                                                                                             
        proxy_pass http://appwww;                                                                            
        proxy_http_version 1.1;                                                                               
        proxy_set_header Upgrade $http_upgrade;                                                               
        proxy_set_header Connection 'upgrade';                                                                
        proxy_set_header Host $host;                                                                          
        proxy_cache_bypass $http_upgrade;                                                                     
    }                                                                                                         

    listen 443 ssl http2; # managed by Certbot                                                                      
    ssl_certificate......; # managed by Certbot            
    ssl_certificate_key........ # managed by Certbot          
    include /.......# managed by Certbot                                     
    ssl_dhparam /.....pem; # managed by Certbot …
Run Code Online (Sandbox Code Playgroud)

nginx amazon-ec2 amazon-ecs docker

3
推荐指数
1
解决办法
5494
查看次数

如何将 aws 证书管理器连接到 terraform 中的 aws_alb_listener?

我在 aws 证书管理器中有证书。

在此输入图像描述

如何将此证书连接到aws_alb_listenerterraform?

现在我从计算机中的文件中获取证书。

resource "aws_alb_listener" "alb_front_https" {
    load_balancer_arn   =   "${aws_alb.demo_eu_alb.arn}"
    port            =   "443"
    protocol        =   "HTTPS"
    ssl_policy      =   "ELBSecurityPolicy-TLS-1-2-Ext-2018-06"
    certificate_arn     =   "${aws_iam_server_certificate.lb_cert.arn}"
    default_action {
        target_group_arn    =   "${aws_alb_target_group.nginx.arn}"
        type            =   "forward"
    }
}

resource "aws_iam_server_certificate" "lb_cert" {
  name              = "lb_cert-${var.app}"
  certificate_body  = "${file("./www.xxx.com/cert.pem")}"
  private_key       = "${file("./www.xxx.com/privkey.pem")}"
  certificate_chain = "${file("./www.xxx.com/chain.pem")}"
}
Run Code Online (Sandbox Code Playgroud)

我想aws_alb_listener在 aws 证书管理器上使用证书。

如何在地形中做到这一点?

amazon-web-services terraform terraform-provider-aws

3
推荐指数
1
解决办法
1165
查看次数

如何向 CloudFront 响应添加标头?

我使用https://observatory.mozilla.org/analyze测试我的网站,我得到了 F 分数。

原因是:

Content Security Policy (CSP) header not implemented
X-XSS-Protection header not implemented 
X-Frame-Options (XFO) header not implemented    
...
Run Code Online (Sandbox Code Playgroud)

我使用 CloudFront 为我的网站提供服务。

我将那些丢失的标头放在 CloudFront 的何处?

在此处输入图片说明

amazon-web-services amazon-cloudfront

3
推荐指数
3
解决办法
2811
查看次数

如何在构建时从生产中排除代码?

在构建期间如何从Webpack捆绑包中排除打字稿代码?

例如,我在app.ts(nodejs应用程序)中有以下代码行:

const thisShouldNotBeInProductionBundleJustInDevBundle = 'aaaaaaa';
Run Code Online (Sandbox Code Playgroud)

我想在使用Webpack配置构建应用程序时排除此代码。

javascript node.js webpack

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

如何在 terraform 中的同一文件中运行多个模块?

我曾经https://github.com/cloudposse/terraform-aws-acm-request-certificate使用 terraform 和 aws 生成证书。

如何在 terraform 中的同一文件中运行多个域?(不是子域)

我尝试这个但我有错误Error: Duplicate module call

module "acm_request_certificate" {
  source                            = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=master"
  domain_name                       = "example.com"
  process_domain_validation_options = true
  ttl                               = "300"
}

module "acm_request_certificate" {
  source                            = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=master"
  domain_name                       = "otherexample.com"
  process_domain_validation_options = true
  ttl                               = "300"
}
Run Code Online (Sandbox Code Playgroud)

我正在寻找类似的解决方案:

const domains = ["example.com", "otherexample.com"]

foreach(domain of domains) {
 module "acm_request_certificate" {
  source                            = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=master"
  domain_name                       = domain
  process_domain_validation_options = true
  ttl                               = "300"
 }
}
Run Code Online (Sandbox Code Playgroud)

terraform terraform-aws-modules

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

如何使用 typescript 编译器 api 更新或插入导入?

我使用transformtypescript 编译器 api 中的函数来更改我的代码。

该函数是递归的并访问每个节点。

当我找到一个StringLiteral时,foo我想添加foo到导入位置,my-lib如下所示:

import { foo } from 'my-lib';
Run Code Online (Sandbox Code Playgroud)

该代码可能已经导入了其他内容,my-lib例如:

import { bar } from 'my-lib';
Run Code Online (Sandbox Code Playgroud)

我想避免这种结果(重复导入):

import { foo } from 'my-lib';
import { bar } from 'my-lib';
Run Code Online (Sandbox Code Playgroud)

我能找到的最接近的解决方案是:

const file = (node as ts.Node) as ts.SourceFile;
const update = ts.updateSourceFileNode(file, [
  ts.createImportDeclaration(
    undefined,
    undefined,
    ts.createImportClause(
      undefined,
      ts.createNamedImports([ts.createImportSpecifier(ts.createIdentifier("default"), ts.createIdentifier("salami"))])
    ),
    ts.createLiteral('salami')
  ),
  ...file.statements
]);
Run Code Online (Sandbox Code Playgroud)

但这些功能已被弃用。我无法返回,ts.createImportDeclaration因为我将得到 的而不是的import代码。StringLiteralfoo

是否有一个函数说“将 y …

abstract-syntax-tree typescript

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