为什么我的 angular 应用程序无法上手 css?
Why my angular application is not picking up handsontable css?
在我的 angular 应用程序中,只有一个组件使用 handsontable,因此 css 不需要应用程序 level.In 我尝试使用如下语法的组件:
styleUrls: ['./../../../node_modules/handsontable-pro/dist/handsontable.full.min.css']
但它没有 effect.Finally 我必须将 handsontable.full.min.css 复制到与我的组件相同的文件夹中,这样引用 styleUrls:
styleUrls: ['./handsontable.full.min.css']
我不喜欢复制,因为这会导致同一个文件出现在两个地方。
[根据可操作文档][1] 要在应用程序级别声明 css,您必须将其添加到 style.css
[1]: https://handsontable.com/docs/7.4.2/frameworks-wrapper-for-angular-installation.html
@import '~handsontable/dist/handsontable.full.css';
我试过将这一行依次放入style.scss和style.css文件中,也没有效果。
我的 Angular 是 7.1.1 & handsontable 是:
"@handsontable-pro/angular": "3.0.0",
"@handsontable/angular": "^5.1.1",
如何避免制作 2 份可上手的副本css?
编辑: 根据 angular.json
"styles": ["projects/survey-webapp/src/styles.css"]
根据@spots 的建议,我添加了 handsontable css 但没有成功:
"styles": [
"projects/survey-webapp/src/styles.css",
"node_modules/handsontable-pro/dist/handsontable.full.min.css"
],
您是否尝试过在 angular.json
中的 styles
数组中添加样式表?我从未使用过 Handsontable,但这是我通常引用第 3 方样式表的方式,例如 bootstrap 或 ag-grid。
你会想要这样的东西:
"styles": [
//other styles...
"node_modules/handsontable-pro/dist/handsontable.full.min.css",
],
在我的 angular 应用程序中,只有一个组件使用 handsontable,因此 css 不需要应用程序 level.In 我尝试使用如下语法的组件:
styleUrls: ['./../../../node_modules/handsontable-pro/dist/handsontable.full.min.css']
但它没有 effect.Finally 我必须将 handsontable.full.min.css 复制到与我的组件相同的文件夹中,这样引用 styleUrls:
styleUrls: ['./handsontable.full.min.css']
我不喜欢复制,因为这会导致同一个文件出现在两个地方。 [根据可操作文档][1] 要在应用程序级别声明 css,您必须将其添加到 style.css [1]: https://handsontable.com/docs/7.4.2/frameworks-wrapper-for-angular-installation.html
@import '~handsontable/dist/handsontable.full.css';
我试过将这一行依次放入style.scss和style.css文件中,也没有效果。 我的 Angular 是 7.1.1 & handsontable 是:
"@handsontable-pro/angular": "3.0.0",
"@handsontable/angular": "^5.1.1",
如何避免制作 2 份可上手的副本css?
编辑: 根据 angular.json
"styles": ["projects/survey-webapp/src/styles.css"]
根据@spots 的建议,我添加了 handsontable css 但没有成功:
"styles": [
"projects/survey-webapp/src/styles.css",
"node_modules/handsontable-pro/dist/handsontable.full.min.css"
],
您是否尝试过在 angular.json
中的 styles
数组中添加样式表?我从未使用过 Handsontable,但这是我通常引用第 3 方样式表的方式,例如 bootstrap 或 ag-grid。
你会想要这样的东西:
"styles": [
//other styles...
"node_modules/handsontable-pro/dist/handsontable.full.min.css",
],