我想在两种不同的场景中使用Compass生成的图标精灵.
background-size
.我先这样做:
$logo-spacing: 20px;
@import "logo/*.png";
@include all-logo-sprites;
Run Code Online (Sandbox Code Playgroud)
现在我可以使用一般创建的CSS类等.logo-twitter
.
两个实现我可以使用的第二个结果(darren131/gist:3410875 - 在Compass中调整sprite的大小):
@mixin resize-sprite($map, $sprite, $percent) {
$spritePath: sprite-path($map);
$spriteWidth: image-width($spritePath);
$spriteHeight: image-height($spritePath);
$width: image-width(sprite-file($map, $sprite));
$height: image-height(sprite-file($map, $sprite));
@include background-size(ceil($spriteWidth * ($percent/100)) ceil($spriteHeight * ($percent/100)));
width: ceil($width*($percent/100));
height: ceil($height*($percent/100));
background-position: 0 floor(nth(sprite-position($map, $sprite), 2) * ($percent/100) );
}
.my-other-div-with-small-logos {
.logo-twitter {
$spriteName: twitter;
$percentage: 40;
@include resize-sprite($logo-sprites, $spriteName, $percentage);
}
}
Run Code Online (Sandbox Code Playgroud)
但如果我有大约30个徽标,我需要为每个精灵类手动重复这个.
是否可以导入文件夹两次,一次是原始大小,另一次是backround-size
属性?或者修改上面提到的方法,在另一个<div class="my-other-div-with-small-logos">
图标显得更小的地方自动创建所有类?
或者我在这里想错了方向?
我的设置如下:
这有效:
var exec = require('child_process').exec;
var aws = require('aws-sdk');
var ses = new aws.SES({
"accessKeyId": "MY_ACCESS_KEY",
"secretAccessKey": "MY_SECRET_ACCESS_KEY",
"region": "A_REGION"
});
var ses = new aws.SES();
exports.handler = function(event, context) {
...code to send email...
};
Run Code Online (Sandbox Code Playgroud)
我想从函数中删除凭据,而是让Lambda从其他地方获取它们.
如果我删除凭据,我会得到:
User `arn:aws:sts::1234567890:assumed-role/lambda_basic_execution/awslambda_1234567890\' is not authorized to perform `ses:SendEmail\' on resource `arn:aws:ses:us-region-123:1234567890:identity/my.identity@domain.com\'
Run Code Online (Sandbox Code Playgroud)
我仍然试图围绕政策,角色和凭据.我首先想到Lambda可能能够从S3环境变量中获取凭据,但我不知道如何设置这些或者无论如何这是正确的方法.
如果有人能给我一个暗示这可能如何起作用的话会很棒.或者如果不可能的话.
我从Lambda函数中删除凭据的主要原因是我想将函数代码添加到git仓库.我对将这些凭据添加到代码仓库感到很难过.
amazon-s3 amazon-web-services amazon-ses amazon-iam aws-lambda