retinajs.com の retina-1.1.0.less コードを使用しようとしています。背景画像がまったく表示されないため、機能していません。
html は次のとおりです。
<head>
<link rel="stylesheet/less" href="../../scripts/retina-1.1.0.less" type="text/css" />
</head>
ここに retina.less があります:
// retina.less
// A helper mixin for applying high-resolution background images (http://www.retinajs.com)
@highdpi: ~"(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";
.at2x(@path, @w: auto, @h: auto) {
background-image: url(@path);
@at2x_path: ~`@{path}.replace(/\.\w+$/, function(match) { return "@2x" + match; })`;
@media @highdpi {
background-image: url("@{at2x_path}");
background-size: @w @h;
}
}
#button {
.at2x('images/button.png');
}
これがCSSです(ただし、重要ではないと思います):
#button {
height: 50px;
width: 50px;
float: left;
margin-right: 10px;
}
button.png
button@2x.png
どちらも images フォルダにあります。LESS ファイルに正しくリンクしていない可能性があると思いますが、修正方法がわかりません。
ありがとう