npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-plugin-import-bk-magic-vue

v2.1.11

Published

babel-plugin-import-bk-magic-vue

Downloads

1,761

Readme

babel-plugin-import-bk-magic-vue

bk-magic-vue 的辅助加载插件,这个插件主要作用是提供一个简化的语法糖,让组件的使用者在引用组件时只需要 import 组件即可同时引入组件和组件的样式。

我们可以使用 importSpecifier 格式和 importDefaultSpecifier 来引用组件。无论何种方式引入组件,均会自动引入组件的样式以及组件库通用的样式 (common.min.css)以及组件本身的样式,无需开发者再手动引入样式。

配置

在项目的 .babelrc 文件中 plugins 增加配置

// baseLibName 是 bk-magic-vue 组件库的 package name,默认值为 bk-magic-vue
{
    "presets": ...,
    "plugins": [
        ...
        ["import-bk-magic-vue", {
            "baseLibName": "bk-magic-vue"
        }]
    ]
}

配置完成后,使用 bk-magic-vue 组件库就可按如下方式使用:

// importSpecifier 方式
import { bkDropdownMenu } from 'bk-magic-vue'
import { bkDatePicker, bkOptionGroup } from 'bk-magic-vue'
import { bkBadge as badge, bkDialog as dialog, bkLoading as loading } from 'bk-magic-vue'
// locale, lang, localeMixin 是 i18n 的辅助函数,引入这三个时,不会引入对应的样式
import { locale, lang, localeMixin } from 'bk-magic-vue'
// importDefaultSpecifier 方式
import bkRadio from 'bk-magic-vue/lib/radio'
import bkTimePicker from 'bk-magic-vue/lib/time-picker'

export default {
    components: {
        bkRadio,
        bkTimePicker
    }
}
console.log(bkRadio)
console.log(bkTimePicker)
// 全量引入,会同时引入全量 css
import bkMagicVue from 'bk-magic-vue'

Test

npm test

Coverage

npm run coverage

ES6 Compile

npm run compile

ES6 Compile Watch

npm run watch