Title: (publicPath) Problem with CSS url path when I add publicPath(deployUrl) in angular-cli.json · Issue #4035 · angular/angular-cli · GitHub
Open Graph Title: (publicPath) Problem with CSS url path when I add publicPath(deployUrl) in angular-cli.json · Issue #4035 · angular/angular-cli
X Title: (publicPath) Problem with CSS url path when I add publicPath(deployUrl) in angular-cli.json · Issue #4035 · angular/angular-cli
Description: Hi, this is my directory: |-src |-app |- assets |-svg |-more.svg |-environments |-index.html |-styles.scss .... I add "deployUrl": "client/dist/", to my angular-cli.json. I have following CSS in the styles.scss: .more { background: url("...
Open Graph Description: Hi, this is my directory: |-src |-app |- assets |-svg |-more.svg |-environments |-index.html |-styles.scss .... I add "deployUrl": "client/dist/", to my angular-cli.json. I have following CSS in th...
X Description: Hi, this is my directory: |-src |-app |- assets |-svg |-more.svg |-environments |-index.html |-styles.scss .... I add "deployUrl": "client/dist/", to my angular-cli.json. I have...
Opengraph URL: https://github.com/angular/angular-cli/issues/4035
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"(publicPath) Problem with CSS url path when I add publicPath(deployUrl) in angular-cli.json","articleBody":"Hi,\r\n\r\nthis is my directory:\r\n\r\n```\r\n|-src\r\n |-app\r\n |- assets\r\n |-svg\r\n |-more.svg\r\n |-environments\r\n |-index.html\r\n |-styles.scss\r\n....\r\n```\r\n\r\nI add ```\"deployUrl\": \"client/dist/\", ``` to my ```angular-cli.json```.\r\n\r\nI have following CSS in the ```styles.scss```:\r\n```\r\n.more {\r\n background: url(\"./assets/svg/more.svg\");\r\n float: right;\r\n height: 24px;\r\n margin-top: 12px;\r\n width: 24px;\r\n}\r\n```\r\nAfter I run ```ng build``` , it will translate to:\r\n```\r\n.more {\r\n background: url(\"client/dist/more.svg\");\r\n float: right;\r\n height: 24px;\r\n margin-top: 12px;\r\n width: 24px;\r\n}\r\n```\r\nWhen I load my application, the background SVG will be loaded from wrong path:\r\n```http://www.xxxx.com/MyApplication/client/dist/client/dist/more.svg```\r\n\r\nThe correct Path should be:\r\n```http://www.xxxx.com/MyApplication/client/dist/more.svg```\r\n\r\nI can do a quick fix by overriding the ```publicPath``` setting of ```ExtractTextPlugin```\r\n```\r\nif (stylePaths.length > 0) {\r\n // load global css as css files\r\n cssLoaders.push(...baseRules.map(({test, loaders}) => ({\r\n include: stylePaths, test, loaders: ExtractTextPlugin.extract({\r\n remove: false,\r\n loader: ['css-loader', ...commonLoaders, ...loaders],\r\n fallbackLoader: 'style-loader',\r\n publicPath: ''\r\n })\r\n })));\r\n }\r\n```\r\nDoes anyone have the same issue or have a better fix for this?\r\n\r\n\r\n","author":{"url":"https://github.com/changLiuUNSW","@type":"Person","name":"changLiuUNSW"},"datePublished":"2017-01-16T06:17:05Z","url":"https://github.com/angular/angular-cli/issues/4035"}
| 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:f6892e6c-a548-4156-87c1-121f177ab0c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80AA:2E124E:4381DCA:5615512:6B023F35 |
| html-safe-nonce | a83ef087554b97013ddf8869fd169dbad742515905d70d2327c8dbc2093f7ba9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEFBOjJFMTI0RTo0MzgxRENBOjU2MTU1MTI6NkIwMjNGMzUiLCJ2aXNpdG9yX2lkIjoiODA4NTIxMTM0ODc5NzExMjExNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bbdb2dc748d067f4b3d866384de2448a71bcef97c3b487095611a806376335e8 |
| hovercard-subject-tag | issue:200938837 |
| 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/4035/issue_layout |
| twitter:image | https://opengraph.githubassets.com/98ca90a0e04ff9a823b574146d2e5d8dba2dd73cf0af83f67b3637d4fd030a3f/angular/angular-cli/issues/4035 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/98ca90a0e04ff9a823b574146d2e5d8dba2dd73cf0af83f67b3637d4fd030a3f/angular/angular-cli/issues/4035 |
| og:image:alt | Hi, this is my directory: |-src |-app |- assets |-svg |-more.svg |-environments |-index.html |-styles.scss .... I add "deployUrl": "client/dist/", to my angular-cli.json. I have following CSS in th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | changLiuUNSW |
| 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