我應該在哪裏放置一般,跨組件.css
,.scss
,.svg
,.gif
,在角度CLI(的WebPack)項目等資產(例如,主題資源),這樣既我的應用程序的開發和生產版本能夠正常工作而不會發生變哪裏的WebPack資產走在角2 CLI項目
當我產生使用ng new foo --styles=scss
新foo
項目,Angular CLI(angular-cli: 1.0.0-beta.11-webpack.8, node: 6.5.0, os: linux x64
),以下結構創建(與node_modules
修剪):
foo
├── angular-cli.json
├── config
│ ├── karma.conf.js
│ └── protractor.conf.js
├── e2e
│ ├── app.e2e-spec.ts
│ ├── app.po.ts
│ └── tsconfig.json
├── node_modules
├── package.json
├── public
├── README.md
├── src
│ ├── app
│ │ ├── app.component.css
│ │ ├── app.component.html
│ │ ├── app.component.spec.ts
│ │ ├── app.component.ts
│ │ ├── app.module.ts
│ │ ├── environments
│ │ │ ├── environment.dev.ts
│ │ │ ├── environment.prod.ts
│ │ │ └── environment.ts
│ │ ├── index.ts
│ │ └── shared
│ │ └── index.ts
│ ├── favicon.ico
│ ├── index.html
│ ├── main.ts
│ ├── polyfills.ts
│ ├── test.ts
│ ├── tsconfig.json
│ └── typings.d.ts
└── tslint.json
的public
區域似乎是合理的,但怎麼樣.scss
文件? src/app/public
似乎也很合理,但是允許開發和生產版本正確工作的正確目錄是什麼?
文件引用應該在HTML和SCSS文件中看起來像什麼?它們都是基於SCSS文件中源佈局的相對路徑(例如@import '../scss/layout';
)和HTML文件中的絕對路徑(例如,<link href="/assets/css/main.css" rel="stylesheet">
)?
謝謝@Robert - 我該如何處理一組'.scss'「全局」風格的文件? –
我會在styles.scss文件中使用import語句。 '@import'/path/to/file.scss';' –