为什么在 laravel 中将 Sass 与 AgGrid 结合使用时出现错误?
Why am I getting an error when using Sass with AgGrid in laravel?
我在遵循 Ag-Grid vue (https://www.ag-grid.com/vuejs-grid/#vue_theme_look)
指南时发生错误
当我使用普通样式时我没有问题。
错误:
Uncaught Error: Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
-webkit-font-smoothing: antialiased;
^
Declarations may only be used within style rules.
╷
29 │ -webkit-font-smoothing: antialiased;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\ag-grid-community\src\styles\ag-theme-base\sass\_ag-theme-base-mixin.scss 29:5 ag-theme-base()
node_modules\ag-grid-community\src\styles\ag-theme-alpine\sass\_ag-theme-alpine-mixin.scss 8:5 ag-theme-alpine()
resources\sass\_aggrid.scss 4:1 @import
stdin 12:9 root stylesheet
in C:\laragon\www\zonadolar\node_modules\ag-grid-community\src\styles\ag-theme-base\sass\_ag-theme-base-mixin.scss (line 29, column 5)
at C:\laragon\www\zonadolar\node_modules\webpack\lib\NormalModule.js:316:20
at C:\laragon\www\zonadolar\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at C:\laragon\www\zonadolar\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (C:\laragon\www\zonadolar\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at C:\laragon\www\zonadolar\node_modules\sass-loader\dist\index.js:89:7
at Function.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:88191:16)
at _render_closure1.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:77610:12)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26152:18)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26156:19)
at _FutureListener.handleError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24600:19)
at _Future__propagateToListeners_handleError.call[=12=] (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24897:40)
at Object._Future__propagateToListeners (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4311:88)
at _Future._completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24725:9)
at _AsyncAwaitCompleter.completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24117:12)
at Object._asyncRethrow (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4065:17)
at C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:14087:20
at _wrapJsFunctionForAsync_closure.$protected (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4090:15)
at _wrapJsFunctionForAsync_closure.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24138:12)
at _awaitOnObject_closure0.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24130:25)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26152:18)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26156:19)
at _FutureListener.handleError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24600:19)
at _Future__propagateToListeners_handleError.call[=12=] (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24897:40)
at Object._Future__propagateToListeners (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4311:88)
at _Future._completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24725:9)
at _AsyncAwaitCompleter.completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24117:12)
at Object._asyncRethrow (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4065:17)
at C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:16672:20
at _wrapJsFunctionForAsync_closure.$protected (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4090:15)
at _wrapJsFunctionForAsync_closure.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24138:12)
at _awaitOnObject_closure0.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24130:25)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26152:18)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26156:19)
at _FutureListener.handleError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24600:19)
at _Future__propagateToListeners_handleError.call[=12=] (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24897:40)
at Object._Future__propagateToListeners (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4311:88)
at Object../resources/sass/app.scss (http://zonadolar.test/js/app.js:81476:7)
at __webpack_require__ (http://zonadolar.test/js/app.js:20:30)
at Object.0 (http://zonadolar.test/js/app.js:81488:18)
at __webpack_require__ (http://zonadolar.test/js/app.js:20:30)
at http://zonadolar.test/js/app.js:84:18
at http://zonadolar.test/js/app.js:87:10
./resources/sass/app.scss @ app.js:81476
__webpack_require__ @ app.js:20
0 @ app.js:81488
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87
resources/sass/_aggrid.scss
@import "../../node_modules/ag-grid-community/src/styles/ag-grid.scss";
@import "../../node_modules/ag-grid-community/src/styles/ag-theme-alpine/sass/ag-theme-alpine-mixin.scss";
@include ag-theme-alpine((
add-row-background-color: #ACE
));
显然在注释@include 时错误消失了
- Laravel 6
- Windows 10 与 Laragon(本地)
已经解决。
显然文档是错误的。
不是 add-row-background-color: #ACE
应该是 odd-row-background-color: #ACE
我在遵循 Ag-Grid vue (https://www.ag-grid.com/vuejs-grid/#vue_theme_look)
指南时发生错误当我使用普通样式时我没有问题。
错误:
Uncaught Error: Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
-webkit-font-smoothing: antialiased;
^
Declarations may only be used within style rules.
╷
29 │ -webkit-font-smoothing: antialiased;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\ag-grid-community\src\styles\ag-theme-base\sass\_ag-theme-base-mixin.scss 29:5 ag-theme-base()
node_modules\ag-grid-community\src\styles\ag-theme-alpine\sass\_ag-theme-alpine-mixin.scss 8:5 ag-theme-alpine()
resources\sass\_aggrid.scss 4:1 @import
stdin 12:9 root stylesheet
in C:\laragon\www\zonadolar\node_modules\ag-grid-community\src\styles\ag-theme-base\sass\_ag-theme-base-mixin.scss (line 29, column 5)
at C:\laragon\www\zonadolar\node_modules\webpack\lib\NormalModule.js:316:20
at C:\laragon\www\zonadolar\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at C:\laragon\www\zonadolar\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (C:\laragon\www\zonadolar\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at C:\laragon\www\zonadolar\node_modules\sass-loader\dist\index.js:89:7
at Function.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:88191:16)
at _render_closure1.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:77610:12)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26152:18)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26156:19)
at _FutureListener.handleError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24600:19)
at _Future__propagateToListeners_handleError.call[=12=] (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24897:40)
at Object._Future__propagateToListeners (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4311:88)
at _Future._completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24725:9)
at _AsyncAwaitCompleter.completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24117:12)
at Object._asyncRethrow (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4065:17)
at C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:14087:20
at _wrapJsFunctionForAsync_closure.$protected (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4090:15)
at _wrapJsFunctionForAsync_closure.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24138:12)
at _awaitOnObject_closure0.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24130:25)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26152:18)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26156:19)
at _FutureListener.handleError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24600:19)
at _Future__propagateToListeners_handleError.call[=12=] (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24897:40)
at Object._Future__propagateToListeners (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4311:88)
at _Future._completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24725:9)
at _AsyncAwaitCompleter.completeError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24117:12)
at Object._asyncRethrow (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4065:17)
at C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:16672:20
at _wrapJsFunctionForAsync_closure.$protected (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4090:15)
at _wrapJsFunctionForAsync_closure.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24138:12)
at _awaitOnObject_closure0.call (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24130:25)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26152:18)
at _RootZone.runBinary (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:26156:19)
at _FutureListener.handleError (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24600:19)
at _Future__propagateToListeners_handleError.call[=12=] (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:24897:40)
at Object._Future__propagateToListeners (C:\laragon\www\zonadolar\node_modules\sass\sass.dart.js:4311:88)
at Object../resources/sass/app.scss (http://zonadolar.test/js/app.js:81476:7)
at __webpack_require__ (http://zonadolar.test/js/app.js:20:30)
at Object.0 (http://zonadolar.test/js/app.js:81488:18)
at __webpack_require__ (http://zonadolar.test/js/app.js:20:30)
at http://zonadolar.test/js/app.js:84:18
at http://zonadolar.test/js/app.js:87:10
./resources/sass/app.scss @ app.js:81476
__webpack_require__ @ app.js:20
0 @ app.js:81488
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87
resources/sass/_aggrid.scss
@import "../../node_modules/ag-grid-community/src/styles/ag-grid.scss";
@import "../../node_modules/ag-grid-community/src/styles/ag-theme-alpine/sass/ag-theme-alpine-mixin.scss";
@include ag-theme-alpine((
add-row-background-color: #ACE
));
显然在注释@include 时错误消失了
- Laravel 6
- Windows 10 与 Laragon(本地)
已经解决。
显然文档是错误的。
不是 add-row-background-color: #ACE
应该是 odd-row-background-color: #ACE