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

@pluve/antd-rest

v1.1.2

Published

根据UI设计稿,重置部分antd的样式

Downloads

27

Readme

@pluve/antd-rest

基于后台设计规范(1366*768)为参考,重置了antd的样式 基于运营门户紧凑版为参考,重置了antd的样式

简介

本文只针对 antd@4ant-design-vue@3的组件库进行内部的规范样式调整,antd@5暂未支持。

安装

yarn add @pluve/antd-rest
npm install @pluve/antd-rest

文档

查看文档

使用

1.导出 modifyVars 变量

import { theme } from '@pluve/antd-rest';
// 或者
const { theme } = require('@pluve/antd-rest');

// 如需要紧凑版的样式变量
import { setThemePrefix } from '@pluve/antd-rest';

const theme = setThemePrefix({
  // 紧凑模式
  compact: true,
  // 是否不带@符号
  stripPrefix: true,
});

2.引入个性化样式文件

// 可以在入口ts文件内引入
import "@pluve/antd-rest/dist/style/antd-rest.min.css";
// 也可以在入口css或者全局css内引入
@import "~@pluve/antd-rest/dist/style/antd-rest.min.css";

// 紧凑模式的css
import "@pluve/antd-rest/dist/style/antd-rest.compact.min.css";

3.通过 less 的 modifyVars 进行变量覆盖

webpack
module.exports = {
  rules: [
    {
      test: /\.less$/,
      use: [
        // ...其他loader
        {
          loader: 'less-loader',
          options: {
            lessOptions: {
              javascriptEnabled: true,
              modifyVars: {
                ...theme,
              },
            },
          },
        },
      ],
    },
  ],
};
注意

create-react-app + customize-cra
// config-overrides.js
const { override,addLessLoader } = = require("customize-cra");

module.exports = override(
    addLessLoader({
          lessOptions: {
            javascriptEnabled: true,
            modifyVars: { ...theme },
      },
    })
)
注意
  • 因为 create-react-app 与 react-app-rewired 是基于 webpack4 来开发的,所以 less-loader 的版本也不能太高,推荐 6 - 7 的版本。

vite
// vite.config.ts
import { defineConfig } from 'vite';
export default () => {
  defineConfig({
    plugins: [
      Components({
        resolvers: [
          AntDesignVueResolver({
            importStyle: 'less',
            resolveIcons: true,
          }),
        ],
      }),
    ],
    css: {
      preprocessorOptions: {
        less: {
          javascriptEnabled: true,
          modifyVars: {
            ...theme,
          },
        },
      },
    },
  });
};

其他功能

1.如何获取插件内使用到的 less 变量文件?

@import "~@pluve/antd-rest/dist/style/antd-rest.var.less"

// 紧凑模式
@import "~@pluve/antd-rest/dist/style/antd-rest.compact.var.less"

2.如何获取theme的数据,不带有@符号?

import { setThemePrefix } from '@pluve/antd-rest';
const theme = setThemePrefix(true);
//  { 'primary-color': '#1890ff', ... }

说明

如在使用中遇到样式不符合或未按照 UI 规范重写的问题,请在前端群反馈。