iview / iview-admin

Vue 2.0 admin management system template based on iView
https://admin.iviewui.com/
MIT License
16.48k stars 4.84k forks source link

关于自定义样式报错 #286

Closed Eunknight closed 6 years ago

Eunknight commented 6 years ago

变量覆盖(推荐) # 如果你的项目使用了 webpack 工程,可以通过变量覆盖的方式来实现主题定制。 首先在项目中先建一个目录,比如 my-theme,然后在 my-theme 下建立一个 less 文件 index.less,并写入下面内容: @import '~iview/src/styles/index.less';

// Here are the variables to cover, such as: @primary-color: #8c0776; 完整的变量列表可以查看 默认样式变量。 然后在入口文件 main.js 内导入这个 less 文件即可: import Vue from 'vue'; import iView from 'iview'; import '../my-theme/index.less';

Vue.use(iView);

按iview要求引入自定义样式,npm run dev 报错 ,在vue-cli下测试没有问题. 报错内容:

ERROR in ./~/_css-hot-loader@1.3.4@css-hot-loader!./~/_autoprefixer-loader@2.1.0@autoprefixer-loader!./~/_less-loader@2.2.3@less-loader!./src/my-theme/index.less Module parse failed: E:\study\iview-admin-template\node_modules_css-hot-loader@1.3.4@css-hot-loader\index.js!E:\study\iview-admin-template\node_modules_autoprefixer-loader@2.1.0@autoprefixer-loader\index.js!E:\study\iview-admin-template\node_modules_less-loader@2.2.3@less-loader\index.js!E:\study\iview-admin-template\src\my-theme\index.less Unexpected token (1:0) You may need an appropriate loader to handle this file type. | .ivu-load-loop { | -webkit-animation: ani-load-loop 1s linear infinite; | animation: ani-load-loop 1s linear infinite;

Eunknight commented 6 years ago

https://github.com/iview/iview/issues/900

rqhansen commented 6 years ago

老哥,没能识别less文件的问题解决了吗,我现在也碰到这个问题了,求指导