Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lesca-cdn-path

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lesca-cdn-path

relative path to absolute path

  • 2.0.6
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-88.89%
Maintainers
1
Weekly downloads
 
Created
Source

NPM React React React React React NPM

Why use it.

Use it when image is separated from the server.

Installation

npm install lesca-cdn-path --save

Usage

As a Node module: install in entry js.

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

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

setup mode

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

// ? test at 'localhost'?;
config.mode = 'localhost'; // default is 'cdn'

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 import
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

Propertiesdescriptionoptionsdefault
config.mode:stingurl loader mode.cdn, localhost'cdn'

Features

  • maintain if necessary

Keywords

FAQs

Package last updated on 28 Mar 2022

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc