@import '~antd/lib/style/themes/default.less';

不太了解less和webpack。

@import '~antd/lib/style/themes/default.less';

请问这一句的@import 和~antd是什么意思?

阅读 9.6k
2 个回答

关于@import:
sass关于@import的介绍
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining multiple stylesheets' CSS together. Unlike plain CSS imports, which require the browser to make multiple HTTP requests as it renders your page, Sass imports are handled entirely during compilation.

Sass imports have the same syntax as CSS imports, except that they allow multiple imports to be separated by commas rather than requiring each one to have its own @import. Also, in the indented syntax, imported URLs aren’t required to have quotes.

关于~antd:
~ 的写法表明当前用的是别名引入, webpack的alias 应当有对应的配置, 就和常用的@/path一样

 alias: {
        "antd": "xxx/yyy"
}

@import 导入样式

作为模块导入

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题