我正在使用 Sage 框架来构建一个 WordPress 网站,并且想使用一个自定义 CSS 框架,即 Materialize CSS。Sage 使用 Webpack 构建 CSS。
在构建时,我收到以下错误消息:
WAIT Compiling... 1:55:57 PM
ERROR Failed to compile with 1 errors 1:55:57 PM
error in ./resources/assets/styles/main.scss
Module build failed:
.#{$color_name}.#{$color_type} {
^
Invalid CSS after ".white": expected selector, was ".#0a0a0a"
in /mnt/c/Users/Kenny/Local Sites/ngcsaget1/app/public/wp-content/themes/ngc11/node_modules/materialize-css/sass/components/_color-classes.scss (line 14, column 7)
@ ./resources/assets/styles/main.scss 2:14-358 21:1-42:3 22:19-363
@ multi ./resources/assets/build/util/../helpers/hmr-client.js ./scripts/main.js ./styles/main.scss
这是 Materialize Github 存储库:https ://github.com/Dogfalo/materialize
如果需要,这里是 Sage 框架的 github,webpack.config.js 在 build 文件夹中:https ://github.com/roots/sage/tree/master/resources/assets
笔记:
尝试导入.scss
文件时出现错误:
@import "~materialize-css/sass/materialize";
如果我导入完整.css
文件,我可以访问框架,但它是普通的 css:
@import "~materialize-css/dist/css/materialize";
这是 webpack 代码:https ://github.com/roots/sage/blob/master/resources/assets/build/webpack.config.js