srcset

WebJar for srcset

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

srcset
Последняя версия

Последняя версия

2.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

srcset
WebJar for srcset
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/sindresorhus/srcset

Скачать srcset

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/srcset/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>srcset</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/srcset/
implementation 'org.webjars.npm:srcset:2.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/srcset/
implementation ("org.webjars.npm:srcset:2.0.1")
'org.webjars.npm:srcset:jar:2.0.1'
<dependency org="org.webjars.npm" name="srcset" rev="2.0.1">
  <artifact name="srcset" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='srcset', version='2.0.1')
)
libraryDependencies += "org.webjars.npm" % "srcset" % "2.0.1"
[org.webjars.npm/srcset "2.0.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

srcset Build Status

Parse and stringify the HTML <img> srcset attribute.

Can be useful if you're creating a build-tool.

Install

$ npm install srcset

Usage

How an image with srcset might look like:

<img alt="The Breakfast Combo"
     src="banner.jpg"
     srcset="banner-HD.jpg 2x, banner-phone.jpg 100w, banner-phone-HD.jpg 100w 2x">

Then have some fun with it:

const srcset = require('srcset');

const parsed = srcset.parse('banner-HD.jpg 2x, banner-phone.jpg 100w');
console.log(parsed);
/*
[
	{
		url: 'banner-HD.jpg',
		density: 2
	},
	{
		url: 'banner-phone.jpg',
		width: 100
	}
]
*/

parsed.push({
	url: 'banner-phone-HD.jpg',
	width: 100,
	density: 2
});

const stringified = srcset.stringify(parsed);
console.log(stringified);
/*
banner-HD.jpg 2x, banner-phone.jpg 100w, banner-phone-HD.jpg 100w 2x
*/

API

.parse()

Accepts a srcset string and returns an array of objects with the possible properties: url (always), width, density.

.stringify()

Accepts an array of objects with the possible properties: url (required), width, density and returns a srcset string.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Версии библиотеки

Версия
2.0.1
1.0.0