2016-12-01 10 views
1

System.configなしで含めるには、ngで生成されたAngularJS 2プロジェクトを使用しますか?node_modules in AngularJS 2 [ng cli] System.configなし

試み(src/index.html中):

<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css"> 
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css"> 
<link rel="stylesheet" href="bootstrap/dist/css/bootstrap.min.css"> 
<link rel="stylesheet" href="dist/css/bootstrap.min.css"> 
<link rel="stylesheet" href="css/bootstrap.min.css"> 
<link rel="stylesheet" href="bootstrap.min.css"> 

プロジェクトの設定:

npm install -g angular2-cli 
ng init 
npm install 
npm install --save [email protected] 
npm start 

注:もうsystemjs.config.jsやファイル・ツリー内のSystem.configへの参照でもないがある[デフォルト] ...

EDIT:含まれているすべてのnode_moduleも1つのバンドルにプッシュされていると素晴らしいでしょう(例:ng build -prod)。ビルドとCSSなどnode_module資産が含まれるように

+1

[README on github](https://github.com/angular/angular-cli)から:「Beta.10とBeta.14の間でビルドシステムをSystemJSからWebpackに変更しました。この質問には再度タグを付ける必要があります。 – artem

+0

完了。関連性があるので、[タグ:systemjs]を含めて、まだ記録されています。 –

答えて

1

、あなたはこのようなangular-cli.jsonでそれをリストする必要があります。

{ 
    "apps": [ 
    { 
     "styles": [ 
     "../node_modules/bootstrap/dist/css/bootstrap.css" 
     ] 
    } 
    ] 
} 

はまた、角度-cliのREADMEからGlobal Library Installationをチェックアウト。

ng build -prodを実行すると、cliはリストされたファイルをバンドルします。

+0

+1と受け入れ:完璧ですところで、私は今日のようなものを試してみましたが、 'node_modules/bootstrap/dist/css/bootstrap.css'を試したと思います。 –

+1

うれしいことに、うれしいです! – adriancarriger