1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = retinaImage;
|
5 | var _hiDPI = _interopRequireDefault(require("./hiDPI"));
|
6 | var _errors = _interopRequireDefault(require("../internalHelpers/_errors"));
|
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
8 | function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
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 | function retinaImage(filename, backgroundSize, extension, retinaFilename, retinaSuffix) {
|
38 | var _ref;
|
39 | if (extension === void 0) {
|
40 | extension = 'png';
|
41 | }
|
42 | if (retinaSuffix === void 0) {
|
43 | retinaSuffix = '_2x';
|
44 | }
|
45 | if (!filename) {
|
46 | throw new _errors["default"](58);
|
47 | }
|
48 |
|
49 | var ext = extension.replace(/^\./, '');
|
50 | var rFilename = retinaFilename ? retinaFilename + "." + ext : "" + filename + retinaSuffix + "." + ext;
|
51 | return _ref = {
|
52 | backgroundImage: "url(" + filename + "." + ext + ")"
|
53 | }, _ref[(0, _hiDPI["default"])()] = _extends({
|
54 | backgroundImage: "url(" + rFilename + ")"
|
55 | }, backgroundSize ? {
|
56 | backgroundSize: backgroundSize
|
57 | } : {}), _ref;
|
58 | }
|
59 | module.exports = exports.default; |
\ | No newline at end of file |