You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@procore/cdn

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@procore/cdn

Resolve the procore CDN

1.0.2
Source
npm
Version published
Weekly downloads
294
-6.67%
Maintainers
8
Weekly downloads
 
Created
Source

Resolve Procore CDN

Motivation

Browsers only allow 6 current requests to the same domain. In order to overcome this restriction procore has 5 subdomains for fastly. This helper function will alternate between the subdomains in a sequence of 0-4.

Usage

import cdn from '@procore/cdn';
import testImg from './test.png';
import bgImg from './bg.jpg';


const App = () => {
  return (
    <div>
      <img src={cdn(testImg)} /> 
      /*
        https://procore-production-assets0.global.ssl.fastly.net/22028741.png
      */
      <div style={{ backgroundImage: `url(${cdn(bgImg)})`} />
      /*
        <div style="background-image: url(https://procore-production-assets1.global.ssl.fastly.net/03852981.jpg)></div>
      */
    </div>
  )
}

Keywords

cdn

FAQs

Package last updated on 28 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts