Socket
Socket
Sign inDemoInstall

lesca-cdn-path

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lesca-cdn-path

relative path to absolute path


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

NPM React React React React React NPM

lesca-cdn-path

Use it when image is separated from html.

Installation

npm install lesca-cdn-path --save

Usage

As a Node module:

import { install } from 'lesca-cdn-path';

install('https://cdn.hostname.com/files/');

In the compnenet

  • use require
import { path } from 'lesca-cdn-path';

const component = () => <img src={path(require('./img/image.jpg'))} />;
// http://localhost:8080/img/image.jpg => https://cdn.hostname.com/files/img/image.jpg
  • use ES6
import { path } from 'lesca-cdn-path';
import Image from './img/image.jpg';

const component = () => <img src={path(Image)} />;
// http://localhost:8080/img/image.jpg => https://cdn.hostname.com/files/img/image.jpg

Development

Methods

methoddescriptionreturn
.install(cdn-path:string)set the base path was generated by the CDNvoid
.path(local-path:string)localhost url pathcdn-path

Properties

Propertiesdescriptiondefault
config.enable:booleanuse cdn filetrue

Features

  • maintain if necessary

Keywords

FAQs

Last updated on 24 Mar 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc