excaliburhan / xp-loadcss

动态导入css,支持promise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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')
  })

About

动态导入css,支持promise


Languages

Language:JavaScript 71.9%Language:TypeScript 28.1%