Title: Assets not found in scss/css when using base-href · Issue #4782 · angular/angular-cli · GitHub
Open Graph Title: Assets not found in scss/css when using base-href · Issue #4782 · angular/angular-cli
X Title: Assets not found in scss/css when using base-href · Issue #4782 · angular/angular-cli
Description: Please provide us with the following information: OS? Windows 10 x64 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.28.3] node: 7.2.0 os: win32 x64 @angular/common: 2.4.7 @angular/compiler: 2.4.7 @angular/core: 2.4.7 @angular/forms:...
Open Graph Description: Please provide us with the following information: OS? Windows 10 x64 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.28.3] node: 7.2.0 os: win32 x64 @angular/common: 2.4.7 @angular/compiler: 2....
X Description: Please provide us with the following information: OS? Windows 10 x64 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.28.3] node: 7.2.0 os: win32 x64 @angular/common: 2.4.7 @angular/compiler: 2....
Opengraph URL: https://github.com/angular/angular-cli/issues/4782
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assets not found in scss/css when using base-href","articleBody":"> Please provide us with the following information:\r\n> ---------------------------------------------------------------\r\n\r\n### OS?\r\nWindows 10 x64\r\n\r\n### Versions.\r\n@angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.28.3]\r\nnode: 7.2.0\r\nos: win32 x64\r\n@angular/common: 2.4.7\r\n@angular/compiler: 2.4.7\r\n@angular/core: 2.4.7\r\n@angular/forms: 2.4.7\r\n@angular/http: 2.4.7\r\n@angular/platform-browser: 2.4.7\r\n@angular/platform-browser-dynamic: 2.4.7\r\n@angular/router: 3.4.7\r\n@angular/cli: 1.0.0-beta.32.3\r\n@angular/compiler-cli: 2.4.7\r\n\r\n### Repro steps.\r\ncreate an app with ng-cli. create a build for a server (not ng serve) with base-href set to xxx. use url's in scss (like background-image: url('/assets/img/myimg'). the imagepath for the url will be set to server/assets/img/myimg instead of server/xxx/assets/img/myimg. If I try to use a relative path in the scss (ie url('./assets/img/myimg') ) i get a compileerror, that this is not resolveable. If i try to use url('assets/img/myimg') this is also not resolveable for the compiler.\r\nmy .angular-cli.json has this section: \r\n \"assets\": [\r\n \"assets\",\r\n \"favicon.ico\"\r\n ],\r\n\r\n### The log given by the failure.\r\nThere is only a compileerror that the path is not resolveable or a runtime 404 when the resource is not found without using the base-ref in the url.\r\n\r\n### Mention any other details that might be useful.\r\nThere is a workaround for this issue: i set the style in my component directly and inject it like this: \r\n\u003cspan ... [style.background-image]=\"getLogo()\">\u003c/span> \r\n\r\n getLogo() {\r\n return this._domSanitizer.bypassSecurityTrustStyle(`url(${this.logosrc}`);\r\n }\r\n\r\nwhere logosrc = \"./assets/img/myimg\"\r\n> ---------------------------------------------------------------\r\n> Thanks! We'll be in touch soon.\r\n","author":{"url":"https://github.com/maxpfandl","@type":"Person","name":"maxpfandl"},"datePublished":"2017-02-17T13:04:27Z","url":"https://github.com/angular/angular-cli/issues/4782"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b7db0395-2fc0-b5a1-36ab-15729846ab99 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 93D4:DB09F:3B96019:4C04A05:6B0211F0 |
| html-safe-nonce | 360a2ace6ab35df389de28625b5830eafa6bcbd41e555cc86b710dce628dc373 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5M0Q0OkRCMDlGOjNCOTYwMTk6NEMwNEEwNTo2QjAyMTFGMCIsInZpc2l0b3JfaWQiOiI5MjE2MTA0MjkxNTM4MDg4ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 146e00b02cd8384522e97963d7c1ae34aa15f9f1090d0dc5699ed55084cf848b |
| hovercard-subject-tag | issue:208436055 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/4782/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0a9d6d0ef3a83039a7a5aaf7eaf52b40435ae83f811009a6616531c2bd47761e/angular/angular-cli/issues/4782 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0a9d6d0ef3a83039a7a5aaf7eaf52b40435ae83f811009a6616531c2bd47761e/angular/angular-cli/issues/4782 |
| og:image:alt | Please provide us with the following information: OS? Windows 10 x64 Versions. @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.28.3] node: 7.2.0 os: win32 x64 @angular/common: 2.4.7 @angular/compiler: 2.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxpfandl |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width