将第三方资源添加到Angular 4

Fır*_*ÇÜK 6 javascript angular

一般来说,我更喜欢在.angular-cli.json中添加第三方资源

{
  "styles"           : [
    "../bower_components/animate.css/animate.css",
    "../bower_components/chosen/chosen.css",
    "../bower_components/cropper/dist/cropper.css",
    "../bower_components/font-awesome/css/font-awesome.min.css",
    "../bower_components/nprogress/nprogress.css"
  ],
  "scripts"          : [
    "../bower_components/jquery/dist/jquery.js",
    "../bower_components/bootstrap/dist/js/bootstrap.js",
    "../bower_components/bootstrap-progressbar/bootstrap-progressbar.js",
    "../bower_components/chosen/chosen.jquery.js",
    "../bower_components/cropper/dist/cropper.js",
    "../bower_components/fastclick/lib/fastclick.js",
    "../bower_components/nprogress/nprogress.js"
  ]
}
Run Code Online (Sandbox Code Playgroud)

这种方法可以帮助我在Angular 2/4旁边使用bower,并且构建过程可以在一个包中整合所有依赖项.但是大量的依赖关系使应用程序初始化延迟.那么定义所有这样的组件比在需要的组件中使用资源更有效吗?

例如:我们在联系人和公司页面中使用datepicker组件."从contacts.component.css和companies.component.css action导入datepicker样式"是否会通过牺牲大小来减少加载时间?