René's URL Explorer Experiment


Title: Prefixable style imports similar to tsconfig.json's compilerOptions.paths · Issue #12573 · angular/angular-cli · GitHub

Open Graph Title: Prefixable style imports similar to tsconfig.json's compilerOptions.paths · Issue #12573 · angular/angular-cli

X Title: Prefixable style imports similar to tsconfig.json's compilerOptions.paths · Issue #12573 · angular/angular-cli

Description: Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Command (mark with an x) - [ ] new - [] build - [] serve - [] test - [ ] e2e - [ ] generate - [ ] add - [ ] u...

Open Graph Description: Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Command (mark with an x) - [ ] new - [] build - [] serve - [] test - ...

X Description: Bug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Command (mark with an x) - [ ] new - [] build - [] serve - [] test...

Opengraph URL: https://github.com/angular/angular-cli/issues/12573

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Prefixable style imports similar to tsconfig.json's compilerOptions.paths","articleBody":"### Bug Report or Feature Request (mark with an `x`)\r\n```\r\n- [ ] bug report -> please search issues before submitting\r\n- [x] feature request\r\n```\r\n\r\n### Command (mark with an `x`)\r\n```\r\n- [ ] new\r\n- [] build\r\n- [] serve\r\n- [] test\r\n- [ ] e2e\r\n- [ ] generate\r\n- [ ] add\r\n- [ ] update\r\n- [ ] lint\r\n- [ ] xi18n\r\n- [ ] run\r\n- [x] config\r\n- [ ] help\r\n- [ ] version\r\n- [ ] doc\r\n```\r\n\r\n### Versions\r\n```\r\ndamien$ node --version\r\nv8.9.4\r\n-----\r\ndamien$ ng --version\r\n\r\n     _                      _                 ____ _     ___\r\n    / \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|\r\n   / △ \\ | '_ \\ / _` | | | | |/ _` | '__|   | |   | |    | |\r\n  / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |\r\n /_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|\r\n                |___/\r\n    \r\n\r\nAngular CLI: 6.2.3\r\nNode: 8.9.4\r\nOS: darwin x64\r\nAngular: \r\n... \r\n\r\nPackage                      Version\r\n------------------------------------------------------\r\n@angular-devkit/architect    0.8.3\r\n@angular-devkit/core         0.8.3\r\n@angular-devkit/schematics   0.8.3\r\n@schematics/angular          0.8.3\r\n@schematics/update           0.8.3\r\nrxjs                         6.2.2\r\ntypescript                   2.9.2\r\n```\r\n\r\n### Repro steps\r\n1. Add two libraries with the same scss file name: e.g `sample.scss`\r\n2. Add both libraries scss paths to your `projects.project.architect.build.stylePreprocessorOptions.includePaths`\r\n```\r\n \"build\": {\r\n          \"builder\": \"@angular-devkit/build-angular:browser\",\r\n          \"options\": {\r\n            \"outputPath\": \"dist/apps/demo\",\r\n            \"index\": \"apps/demo/src/index.html\",\r\n            \"main\": \"apps/demo/src/main.ts\",\r\n            \"polyfills\": \"apps/demo/src/polyfills.ts\",\r\n            \"tsConfig\": \"apps/demo/tsconfig.json\",\r\n            \"assets\": [\r\n              \"apps/demo/src/assets\",\r\n              \"apps/demo/src/favicon.ico\"\r\n            ],\r\n            \"styles\": [\r\n              \"apps/demo/src/scss/styles.scss\"\r\n            ],\r\n            \"stylePreprocessorOptions\": {\r\n              \"includePaths\": [\r\n                \"apps/demo/src/scss\",\r\n                \"libs/design/scss\"\r\n              ]\r\n            },\r\n            \"scripts\": []\r\n          }\r\n        },\r\n```\r\n3. In your `src/styles.scss` reference the `sample.scss` file.\r\n```\r\n@import \"sample.scss\"\r\n```\r\n4. Be unsure which file is chosen by `sass-loader`\r\n\r\n### Desired functionality\r\n1. Add two libraries that happen to have the same scss file name: e.g `sample.scss`\r\n2. Add both libraries scss paths to your `projects.project.architect.build.stylePreprocessorOptions.includePaths` but INCLUDE a prefix if desired.\r\n```\r\n\"build\": {\r\n          \"builder\": \"@angular-devkit/build-angular:browser\",\r\n          \"options\": {\r\n            \"outputPath\": \"dist/apps/demo\",\r\n            \"index\": \"apps/demo/src/index.html\",\r\n            \"main\": \"apps/demo/src/main.ts\",\r\n            \"polyfills\": \"apps/demo/src/polyfills.ts\",\r\n            \"tsConfig\": \"apps/demo/tsconfig.json\",\r\n            \"assets\": [\r\n              \"apps/demo/src/assets\",\r\n              \"apps/demo/src/favicon.ico\"\r\n            ],\r\n            \"styles\": [\r\n              \"apps/demo/src/scss/styles.scss\"\r\n            ],\r\n            \"stylePreprocessorOptions\": {\r\n              \"includePaths\": [\r\n                { path: \"apps/demo/src/scss\", prefix: \"@demo\"},\r\n                { path: \"libs/design/scss\", prefix: \"@design\"},\r\n                \"potentially/some/other/non-prefixed/path\"\r\n              ]\r\n            },\r\n            \"scripts\": []\r\n          }\r\n        },\r\n```\r\n3. In your `src/styles.scss` reference the `sample.scss` file.\r\n```\r\n@import \"@demo/sample.scss\"\r\n@import \"@design/sample.scss\"\r\n```\r\n4. Be sure which sample was imported.\r\n\r\n### Mention any other details that might be useful\r\n\r\n#### Issues & PRs\r\nRevisits #1791\r\nRevisits #4003\r\nRevisits #5287\r\nPotential Solution for #9018\r\n\r\n#### Discussion\r\n\r\nI came about this as a part of considering how to build a [component library](https://github.com/graycoreio/daffodil) for an angular project. It struck me like a thunderbolt after reading @clydin 's commenting saying that the ideas put out by @angular/material2 with imports via `~` [are unsupported](https://github.com/angular/angular-cli/issues/11435#issuecomment-403499086)\r\n\r\nI've also spent a fair bit of time reviewing how webpack's sass-loader works compared to how the AngularCompiler plugin handles loading paths via tsconfig.json. Hats off to @clydin for the [new reliance](https://github.com/angular/angular-cli/pull/11575) on webpack.resolve for handling tsconfig.json `compilerOptions.paths` implementation in v7.0.0. Reviewing all of the PRs and issues on styles up to this point has led me to the following:\r\n\r\nI think the current includePaths functionality is severely limiting and can lead to significant confusion. It's really nice to KNOW where your styles are coming from rather than guessing which path it happens to come from. To this idea, I'd really like to point out the developer experience from component library perspective (think @angular/material2). Specifically, I'd like to clarify via a simple example of how it feels to develop components that use dependent styles (variables, mixins, functions, etc).\r\n\r\n#### Comparative Example\r\n\r\nLet's imagine we treated typescript classes & files (**critical application code**) like how `includePaths` forces us to treat `.scss/.css/.less` files (I'd also argue these are **critical application code**).  \r\n\r\n```\r\nimport { Input };\r\n\r\n//as opposed to:\r\n//import { Input } from '@angular/core';\r\n```\r\n\r\nAs an application maintainer, I'd feel terrified of having any clue as to what was going on with that reference. Who knows where `Input` is coming from, which dependency you're referring to and as such, what the class even does. I can't even imagine maintaining that for a week let alone long term.\r\n\r\nCurrently, this is the experience of an Angular dev working with any kind of styles. \r\n\r\n```bash\r\n//my.component.ts\r\nimport 'util';\r\n\r\n.component {\r\n  @include some-mixin-from-util;\r\n}\r\n```\r\n\r\nLooking at this, I have no idea where `util` comes from, no appreciation for whether or not it's imported from my project or a dependency and no way of knowing how to find the file. If I go check `includePaths` I'm then stuck sifting through how ever many paths are listed there. I feel that it is less than stellar and thus needs to be re-considered.\r\n\r\nIt would be much more sane to do something like:\r\n\r\n```bash\r\n//my.component.ts\r\nimport '@namespace/util';\r\n\r\n.component {\r\n  @include some-mixin-from-util;\r\n}\r\n```\r\n\r\n#### Potential Solution\r\nI could be very wrong here as this is a naive solution, but after reviewing how webpack's `resolve.alias` works, taking advantage of it seems like a decent approach. At build time, we could copy the elements from `projects.PROJECTNAME.architect.build.stylePreprocessorOptions.includePaths` that have prefixes into `resolve.alias` and be good to go. You'd have to reference your style file in your component's stylesheet via an `import '@namespace/util.scss'` but having to include the filetype doesn't seem to be the end of the world. If it won't break anything, we could even include `.scss,.css,.less` in the `resolve.extensions`.","author":{"url":"https://github.com/damienwebdev","@type":"Person","name":"damienwebdev"},"datePublished":"2018-10-12T16:08:51Z","url":"https://github.com/angular/angular-cli/issues/12573"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fb432bba-65ff-055a-7bf2-e5f0cadb5603
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBEDE:62F48:F4C605:1430330:6B020984
html-safe-nonce82e410a342b5dc5adff7987b87163133f6e4153885415897c1c3982f7b3d6284
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRURFOjYyRjQ4OkY0QzYwNToxNDMwMzMwOjZCMDIwOTg0IiwidmlzaXRvcl9pZCI6IjM2NTg3NTQ0OTY2MTM0NTIxNjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace447b25f3d83fb2dbbd8dcf9b633ccb0f1705fe35a8f70bda44d652d9886c1b3
hovercard-subject-tagissue:369615854
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/12573/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a3acf58d888751b12ccc2bb865fff02b1ef4baace43cd9eabb0d108b5c17de27/angular/angular-cli/issues/12573
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a3acf58d888751b12ccc2bb865fff02b1ef4baace43cd9eabb0d108b5c17de27/angular/angular-cli/issues/12573
og:image:altBug Report or Feature Request (mark with an x) - [ ] bug report -> please search issues before submitting - [x] feature request Command (mark with an x) - [ ] new - [] build - [] serve - [] test - ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedamienwebdev
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/12573#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F12573
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F12573
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/12573
Reloadhttps://github.com/angular/angular-cli/issues/12573
Reloadhttps://github.com/angular/angular-cli/issues/12573
angularhttps://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Codehttps://github.com/angular/angular-cli
Issues198 (198)https://github.com/angular/angular-cli/issues
Pull requests23 (23)https://github.com/angular/angular-cli/pulls
Actionshttps://github.com/angular/angular-cli/actions
Security and quality8 (8)https://github.com/angular/angular-cli/security
Insightshttps://github.com/angular/angular-cli/insights
https://github.com/angular/angular-cli
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/12573
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/12573
Prefixable style imports similar to tsconfig.json's compilerOptions.pathshttps://github.com/angular/angular-cli/issues/12573#top
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
Backloghttps://github.com/angular/angular-cli/milestone/12
https://github.com/damienwebdev
damienwebdevhttps://github.com/damienwebdev
on Oct 12, 2018https://github.com/angular/angular-cli/issues/12573#issue-369615854
#1791https://github.com/angular/angular-cli/issues/1791
#4003https://github.com/angular/angular-cli/pull/4003
#5287https://github.com/angular/angular-cli/issues/5287
#9018https://github.com/angular/angular-cli/issues/9018
component libraryhttps://github.com/graycoreio/daffodil
@clydinhttps://github.com/clydin
are unsupportedhttps://github.com/angular/angular-cli/issues/11435#issuecomment-403499086
@clydinhttps://github.com/clydin
new reliancehttps://github.com/angular/angular-cli/pull/11575
damienwebdevhttps://github.com/damienwebdev
on Oct 12, 2018https://github.com/angular/angular-cli/issues/12573#event-1901143583
damienwebdevhttps://github.com/damienwebdev
on Oct 14, 2018https://github.com/angular/angular-cli/issues/12573#event-1902768616
alan-agius4https://github.com/alan-agius4
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
on Oct 15, 2018https://github.com/angular/angular-cli/issues/12573#event-1903467479
ngbothttps://github.com/apps/ngbot
Backloghttps://github.com/angular/angular-cli/milestone/12
on Oct 15, 2018https://github.com/angular/angular-cli/issues/12573#event-1903468068
alan-agius4https://github.com/alan-agius4
needs: discussionOn the agenda for team meeting to determine next stepshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22needs%3A%20discussion%22
on Oct 15, 2018https://github.com/angular/angular-cli/issues/12573#event-1903492467
https://github.com/alexeagle
alexeaglehttps://github.com/alexeagle
on Oct 18, 2018https://github.com/angular/angular-cli/issues/12573#issuecomment-431094807
alexeaglehttps://github.com/alexeagle
completedhttps://github.com/angular/angular-cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 18, 2018https://github.com/angular/angular-cli/issues/12573#event-1912881180
hanslhttps://github.com/hansl
needs: discussionOn the agenda for team meeting to determine next stepshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22needs%3A%20discussion%22
on Jan 24, 2019https://github.com/angular/angular-cli/issues/12573#event-2095248050
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 9, 2019https://github.com/angular/angular-cli/issues/12573#issuecomment-529307993
automatic conversation locking policyhttps://github.com/angular/angular/blob/67d80f/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 9, 2019https://github.com/angular/angular-cli/issues/12573#event-2617423418
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/12573
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/12573
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
BacklogNo due datehttps://github.com/angular/angular-cli/milestone/12
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.