Element: [Bug Report] in nuxt project, custom element-ui theme color cause error!

Created on 28 Nov 2018  ·  7Comments  ·  Source: ElemeFE/element

Element UI version

2.4.6

OS/Browsers version

Win10 1803/Chrome 70.0.3538.110

Nuxt version

2.0.0

Steps to reproduce

  1. create a nuxt.js project, choose integrate element-ui
  2. install node-sass and sass-loader
  3. create element-variables.scss in /assets/
  4. import '~/assets/element-variables.scss' in nuxt.config.js
  5. npm run dev
  6. open project index in Google Chrome

What is Expected?

element theme color changed

What is actually happening?

Invalid or unexpected token

All 7 comments

复现过程

  1. 创建一个nuxt项目,创建过程中直接集成element-ui
  2. 安装node-sass和sass-loader
  3. 在assets/下创建element-variables.scss
  4. 在nuxt.config.js的css属性下引入'~/assets/element-variables.scss'
  5. npm run dev
  6. 打开浏览器进入项目首页
  7. 页面提示报错
// element-variables.scss
/* 改变主题色变量 */
$--color-primary: teal;

/* 改变 icon 字体路径变量,必需 */
$--font-path: '~element-ui/lib/theme-chalk/fonts';

@import "~element-ui/packages/theme-chalk/src/index";
//nuxt.config.js
module.exports = {
css: [
    // 'element-ui/lib/theme-chalk/index.css'
    '~/assets/element-variables.scss'
  ],
}

~element-ui/packages/theme-chalk/src/index

不存在这个文件的。theme-chalk 下的样式都是编译过的。

如果想自定义样式,请参考文档。直接引入编译后的文件吧。

~element-ui/packages/theme-chalk/src/index

不存在这个文件的。theme-chalk 下的样式都是编译过的。

如果想自定义样式,请参考文档。直接引入编译后的文件吧。

不好意思,没看懂您说的内容。element-variables.scss的代码本来就是我从官方文档里复制出来。所以您说“请参考文档。直接引入编译后的文件吧”我实在看不懂。能否请您再具体说明一下呢?谢谢

怎么解决

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sudo-suhas picture sudo-suhas  ·  3Comments

no5no6 picture no5no6  ·  3Comments

chao-hua picture chao-hua  ·  3Comments

yubo111 picture yubo111  ·  3Comments

dbskccc picture dbskccc  ·  3Comments