Skip to content

Latest commit

 

History

History

linaria

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

@remax/plugin-linaria

增加 linaria css in js支持。

安装

$ npm install @remax/plugin-linaria linaria @linaria/shaker @linaria/babel-preset --save
$ yarn add @remax/plugin-linaria linaria @linaria/shaker @linaria/babel-preset

使用

const linaria = require('@remax/plugin-linaria');

module.exports = {
    plugins: [linaria({
        sourceMap: process.env.NODE_ENV !== 'production', // 生产环境不打印sourceMap
    })],
};

根目录新增 babel.config.js 并配置

module.exports = {
    presets: [
        ['remax', {
            framework: 'react',
            ts: true
        }],
        '@linaria' // 添加到 babel-preset
    ]
}

根目录新增 linaria.config.js 并配置

module.exports = {
    rules: [
        {
            action: require('@linaria/shaker').default,
        },
        {
            test: /node_modules[\/\\](?!remax)/,
            action: "ignore"
        }
    ]
}

LICENSE

MIT