Code Monkey home page Code Monkey logo

Comments (3)

kongyijilafumi avatar kongyijilafumi commented on June 5, 2024

在写样式引用antd的less变量的时候,最好是在*.less文件中使用,因为在webpack配置src/assets/theme/var.less已经默认全局使用了@import "~antd/lib/style/themes/default.less";

  • 如图
    image

from react-ant-admin.

chenlongcheck avatar chenlongcheck commented on June 5, 2024

在写样式引用antd的less变量的时候,最好是在*.less文件中使用,因为在webpack配置src/assets/theme/var.less已经默认使用了@import "~antd/lib/style/themes/default.less";


  • 图片

多谢解答!在var.less中定义的less变量可以在全局使用,但是无法动态修改;stylesDir这个属性意思是自定义样式目录的路径
image
但是也没通过less.modifyVars修改
image
这个是如何做到全局修改的呢

from react-ant-admin.

kongyijilafumi avatar kongyijilafumi commented on June 5, 2024

如果你使用 主题色模式(npm run color *),如果修改了var.lessless变量,需要重启项目才可生效,stylesDir属性是在启动的时候,去这个文件夹找less文件,把less变量替换成真正的值。

主题色配置是在项目启动时开始去替换一些less变量,并非是在webpack钩子函数中去热更新替换。因为在之前开发的时候使用antd-theme-generator,webpack去热更新的时候出现项目卡死,所以就没使用热更新less变量,如果你有好的方案,欢迎pr

from react-ant-admin.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.