0.2.7 • Published 5 years ago

@lexiang/babel-plugin-component v0.2.7

Weekly downloads
16
License
MIT
Repository
-
Last release
5 years ago

Introduction

lazy load component, base on babel-plugin-component

Install

yarn add @lexiang/babel-plugin-component -D

Usage

Via .babelrc or babel-loader.

{
  "plugins": [
    ["@lexiang/babel-plugin-component", options]
  ]
}

options

  • libraryName: module name
  • styleLibraryName: style module name
  • styleLibrary: Import a independent theme package with more config
    styleLibrary: {
      "name": "xxx", // same with styleLibraryName
      "base": true,  // if theme package has a base.css
      "path": "[module]/index.css",  // the style path. e.g. module Alert =>  alert/index.css
      "mixin": true  // if theme-package not found css file, then use [libraryName]'s css file
    }
  • style: import css from 'module/index.css', default false
  • libDir: dist directory, default lib
  • root: main file dir, default index
  • camel2Dash: whether parse name to dash mode or not, default true

Example

convert

import { button } from 'components';

to

var button = require('components/lib/button');

style Example

when it is set to true convert

import { button } from 'components';

to

var button = require('components/lib/button/index.css');
0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.3

5 years ago

0.2.4

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.6

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.5

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago