xp-loadcss
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

xp-loadcss

动态导入js,支持promise

Usage

import loadcss from 'xp-loadcss'

// single file
loadcss('https://cdn.bootcss.com/animate.css/3.5.2/animate.css')
  .then(() => {
    console.log('load success')
  })
  .catch(() => {
    console.log('load error')
  })

// multiple files
loadcss(['https://cdn.bootcss.com/animate.css/3.5.2/animate.css', 'https://cdn.bootcss.com/hover.css/2.1.1/css/hover.css'])
  .then(() => {
    console.log('load success')
  })
  .catch(() => {
    console.log('load error')
  })

Readme

Keywords

none

Package Sidebar

Install

npm i xp-loadcss

Weekly Downloads

26

Version

1.0.3

License

MIT

Unpacked Size

14.1 kB

Total Files

13

Last publish

Collaborators

  • xiaoping