babel-plugin-optimization-import

0.1.1 • Public • Published

babel-plugin-optimization-import

This plugin is used to import on demand.

Install

npm install -D babel-plugin-optimization-import

Usage

{
    presets: []
    plugins: [
        ['babel-plugin-optimization-import', {
            library: 'antd',
            directory: 'lib',           // default to 'lib'
            namingRule: 'dash',         // 'little-camel', 'big-camel', 'dash', 'underline', function, default to 'big-camel'.
            importDefault: false,       // default to true.
            style: {                    // true or object, default to null.
                directory: 'style',     // 'style' or '/less/component', default to upper directory.
                namingRule: 'index',    // 'little-camel', 'big-camel', 'dash', 'underline', string, function, default to null.
                ext: 'css'              // js, css, less, sass, default to null.
            }
        }]
    ]
}

Use for antd.

Use for material-ui.

Use for elementalui

Options

{
    library,
    directory,
    namingRule,
    style: {     
        directory,
        namingRule,
        extension
    }
}

library

string, default to null.
Set library name.

directory

string, default to 'lib'.
Set component directory.

namingRule

'little-camel', 'big-camel', 'dash', 'underline' or function, default to 'big-camel'.

importDefault

boolean, default to true. Transform import type to default.

style

boolean or object, default to false. import related style file and set import mode with style.

directory

string, default to component directory. Set style directory.

namingRule

'little-camel', 'big-camel', 'dash', 'underline', custom string or function, default to null.

extension

string, default to null. style file extension, example 'css', 'less', 'sass' or 'js'.

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-optimization-import

Weekly Downloads

4

Version

0.1.1

License

MIT

Unpacked Size

23.6 kB

Total Files

4

Last publish

Collaborators

  • beancommons