Feature Request: Support Custom CSS Directory in Quasar Configuration #17686
Replies: 2 comments 3 replies
-
|
quasar/app-vite/lib/quasar-config-file.js Lines 649 to 654 in d26cc6b This seems to always add quasar/app-vite/lib/quasar-config-file.js Lines 87 to 102 in d26cc6b it seems that you can enter something that is not a string and has a property |
Beta Was this translation helpful? Give feedback.
-
Update (from Discord channel)🌏 Discord feed in #ideas channel I’ve managed to make it work by moving the entire css folder (in our case into src/ui/css). By default, Quasar forces everything in css: [] through the src/css path. The workaround only requires changes in quasar.config.ts: css: [
'~@ui-css/index.scss',
'~@quasar/quasar-ui-qcalendar/src/index.scss',
]Then configure Vite to resolve the alias: extendViteConf(viteConf) {
viteConf.resolve ??= {}
viteConf.resolve.alias ??= {}
Object.assign(viteConf.resolve.alias, {
'@ui-css': '/src/ui/css',
})
}So far this works fine, but it’s clearly just a Vite workaround. /src
├ /boot # Quasar boot files, startup logic
│ └─ ... # e.g. i18n, apollo, pinia, router setup
│
├ /application # Application layer (UseCases, services)
│ └─ ...
│
├ /domain # Pure domain logic: entities, value objects, events
│ └─ ...
│
├ /infrastructure # Interfaces to DB, APIs, external services
│ └─ ...
│
├ /ui # Presentation layer
│ ├─ /components # Vue components
│ ├─ /pages # Page components
│ ├─ /layouts # Layout components
│ ├─ /css # Styles moved here (instead of src/css)
│ └─ ...
│
├ /shared # Shared utilities, types, composables, constants
│ └─ ...
│
└─ quasar.config.ts # Quasar configBenefits of this structure |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Quasar Team,
I am currently working on a project where I am reorganizing the structure to follow SOLID and Domain-Driven Design (DDD) principles. As part of this reorganization, I aim to move the CSS files into a dedicated directory within the interface layer of the project. This aligns with the separation of concerns and the overall architecture.
Currently, I have encountered an issue where it seems that Quasar (newest @quasar/app-vite v2) expects CSS files to reside in the default
src/css/directory. While I can loadapp.scsssuccessfully from another location, the imports within the SCSS files (e.g.,@import "quasar.variables.scss";) are ignored. This limitation makes it difficult to move the CSS files to a different directory while maintaining Quasar's expected behavior.Current Situation:
src/css/directory are not handled as expected.@import "quasar.variables.scss";fail unless the files remain in the default directory.app.scssinquasar.config.ts, the path is incorrectly appended tosrc/css/.Example: If I configure
css: ['src/ui/css/app.scss'], it becomessrc/css/src/ui/css/app.scssinternally.To bypass this, I need to use relative paths like
./../../src/css/app.scss, which feels hacky and causes SCSS imports to stop working.quasar.config.tsfile, similar to howsourceFilescan be configured.Proposed Feature:
Introduce a configuration option in
quasar.config.tsthat allows developers to define a custom directory for CSS files. This could work similarly to thesourceFilesconfiguration, where the root CSS directory can be redefined.Example:
Why This Feature Matters:
Thank you for considering this feature request! I believe it would benefit many developers looking for flexibility in organizing their projects. 🚀
Best regards,
Max
Beta Was this translation helpful? Give feedback.
All reactions