/usr/lib/python3/dist-packages/glue/formats/less.py is in glue-sprite 0.11.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import os
from .css import CssFormat
class LessFormat(CssFormat):
extension = 'less'
template = """
/* glue: {{ version }} hash: {{ hash }} */
{% for image in images %}.{{ image.label }}{{ image.pseudo }}{%- if not image.last %}, {%- endif %}{%- endfor %}{
background-image:url('{{ sprite_path }}');
background-repeat:no-repeat;
-webkit-background-size: {{ width }}px {{ height }}px;
-moz-background-size: {{ width }}px {{ height }}px;
background-size: {{ width }}px {{ height }}px;
{% for r, ratio in ratios.items() %}
@media screen and (-webkit-min-device-pixel-ratio: {{ ratio.ratio }}), screen and (min--moz-device-pixel-ratio: {{ ratio.ratio }}),screen and (-o-min-device-pixel-ratio: {{ ratio.fraction }}),screen and (min-device-pixel-ratio: {{ ratio.ratio }}),screen and (min-resolution: {{ ratio.ratio }}dppx){
background-image:url('{{ ratio.sprite_path }}');
}
{% endfor %}
}
{% for image in images %}
.{{ image.label }}{{ image.pseudo }}{
background-position:{{ image.x ~ ('px' if image.x) }} {{ image.y ~ ('px' if image.y) }};
width:{{ image.width }}px;
height:{{ image.height }}px;
}
{% endfor %}
"""
@classmethod
def populate_argument_parser(cls, parser):
group = parser.add_argument_group("CSS format options")
group.add_argument("--less",
dest="less_dir",
nargs='?',
const=True,
default=os.environ.get('GLUE_LESS', False),
metavar='DIR',
help="Generate LESS files and optionally where")
group.add_argument("--less-template",
dest="less_template",
default=os.environ.get('GLUE_LESS_TEMPLATE', None),
metavar='DIR',
help="Template to use to generate the LESS output.")
|