Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 1.41 KB

no-url-protocols.md

File metadata and controls

77 lines (55 loc) · 1.41 KB

No URL Protocols

Rule no-url-protocols will enforce that protocols and domains are not used within urls.

Options

  • allow-protocol-relative-urls: true/false (defaults to false)

This option is scheduled to be deprecated in favour of the no-url-domains rule in sass-lint 2.0.

Examples

allow-protocol-relative-urls

When allow-protocol-relative-urls: false, the following are allowed:

.foo {
  background-image: url('/img/bar.png');
}

.foo {
  background-image: url('img/bar.png');
}

.foo {
  background-image: url('bar.png');
}

When allow-protocol-relative-urls: false, the following are disallowed:

.foo {
  background-image: url('https://foo.com/img/bar.png');
}

.foo {
  background-image: url('http://foo.com/img/bar.png');
}

.foo {
  background-image: url('//foo.com/img/bar.png');
}

When allow-protocol-relative-urls: true, the following are allowed:

.foo {
  background-image: url('//foo.com/img/bar.png');
}

.foo {
  background-image: url('/img/bar.png');
}

.foo {
  background-image: url('img/bar.png');
}

.foo {
  background-image: url('bar.png');
}

When allow-protocol-relative-urls: true, the following are disallowed:

.foo {
  background-image: url('https://foo.com/img/bar.png');
}

.foo {
  background-image: url('http://foo.com/img/bar.png');
}