feature/move-styles-to-components #874
|
@ -117,3 +117,7 @@ export default defineComponent({
|
|||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
konrad marked this conversation as resolved
|
||||
@import '@/styles/global.scss';
|
||||
</style>
|
|
@ -23,8 +23,6 @@ import {formatDate, formatDateShort, formatDateLong, formatDateSince} from '@/he
|
|||
// @ts-ignore
|
||||
import {VERSION} from './version.json'
|
||||
|
||||
// Add CSS
|
||||
import './styles/vikunja.scss'
|
||||
// Notifications
|
||||
import Notifications from '@kyvg/vue3-notification'
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
@import 'base/all';
|
||||
|
||||
@import 'attachments';
|
||||
@import 'gantt';
|
||||
@import 'labels';
|
||||
@import 'list';
|
||||
@import 'reminders';
|
||||
@import 'switch-view';
|
||||
@import 'task';
|
||||
@import 'taskRelations';
|
||||
@import 'tasks';
|
||||
@import 'teams';
|
||||
@import 'migrator';
|
||||
@import 'comments';
|
||||
@import 'table-view';
|
||||
@import 'kanban';
|
||||
@import 'list-backgrounds';
|
||||
@import 'color-picker';
|
||||
@import 'namespaces';
|
||||
@import 'legal';
|
||||
@import 'keyboard-shortcuts';
|
||||
@import 'api-config';
|
||||
@import 'datepicker';
|
||||
@import 'notifications';
|
||||
@import 'quick-actions';
|
26
src/styles/components/_index.scss
Normal file
26
src/styles/components/_index.scss
Normal file
|
@ -0,0 +1,26 @@
|
|||
@import "base";
|
||||
|
||||
@import "attachments";
|
||||
@import "gantt";
|
||||
@import "tooltip";
|
||||
@import "labels";
|
||||
@import "list";
|
||||
@import "reminders";
|
||||
@import "switch-view";
|
||||
@import "task";
|
||||
@import "taskRelations";
|
||||
@import "tasks";
|
||||
@import "teams";
|
||||
@import "migrator";
|
||||
@import "comments";
|
||||
@import "table-view";
|
||||
@import "kanban";
|
||||
@import "list-backgrounds";
|
||||
@import "color-picker";
|
||||
@import "namespaces";
|
||||
@import "legal";
|
||||
@import "keyboard-shortcuts";
|
||||
@import "api-config";
|
||||
@import "datepicker";
|
||||
@import "notifications";
|
||||
@import "quick-actions";
|
|
@ -1,5 +1,4 @@
|
|||
@import 'card';
|
||||
@import 'fancycheckbox';
|
||||
@import 'multiselect';
|
||||
@import 'scrollbars';
|
||||
@import 'tooltip';
|
||||
@import 'scrollbars';
|
18
src/styles/global.scss
Normal file
18
src/styles/global.scss
Normal file
|
@ -0,0 +1,18 @@
|
|||
@import "fonts";
|
||||
|
||||
@import "transitions";
|
||||
@import "animations";
|
||||
|
||||
// This imports are the same as in "bulma/bulma.sass"
|
||||
// with the expeption of the bulma utilities.
|
||||
// They are imported globally in variables.scss
|
||||
@import "bulma/sass/base/_all";
|
||||
@import "bulma/sass/elements/_all";
|
||||
@import "bulma/sass/form/_all";
|
||||
@import "bulma/sass/components/_all";
|
||||
@import "bulma/sass/grid/_all";
|
||||
@import "bulma/sass/helpers/_all";
|
||||
@import "bulma/sass/layout/_all";
|
||||
|
||||
@import "theme";
|
||||
@import "components";
|
|
@ -1,11 +0,0 @@
|
|||
@import 'theme';
|
||||
|
||||
@import 'content';
|
||||
@import 'form';
|
||||
@import 'link-share';
|
||||
@import 'loading';
|
||||
@import 'navigation';
|
||||
@import 'notification';
|
||||
@import 'offline';
|
||||
@import 'update-notification';
|
||||
@import 'background';
|
11
src/styles/theme/_index.scss
Normal file
11
src/styles/theme/_index.scss
Normal file
|
@ -0,0 +1,11 @@
|
|||
@import "theme";
|
||||
|
||||
@import "content";
|
||||
@import "form";
|
||||
@import "link-share";
|
||||
@import "loading";
|
||||
@import "navigation";
|
||||
@import "notification";
|
||||
@import "offline";
|
||||
@import "update-notification";
|
||||
@import "background";
|
|
@ -1,18 +1,3 @@
|
|||
// bulma utilities are imported in variables.scss
|
||||
@import "bulma/sass/utilities/_all";
|
||||
@import "bulma/sass/base/_all";
|
||||
@import "bulma/sass/elements/_all";
|
||||
@import "bulma/sass/form/_all";
|
||||
@import "bulma/sass/components/_all";
|
||||
@import "bulma/sass/grid/_all";
|
||||
@import "bulma/sass/helpers/_all";
|
||||
@import "bulma/sass/layout/_all";
|
||||
|
||||
|
||||
@import "fonts";
|
||||
|
||||
@import "variables-derived";
|
||||
|
||||
*,
|
||||
*:hover,
|
||||
*:active,
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
// Variables that are derived from bulma variables need to be included after them
|
||||
$mobile: math.div($tablet, 2);
|
|
@ -1,2 +0,0 @@
|
|||
@import 'animations';
|
||||
@import 'transitions';
|
|
@ -3,4 +3,10 @@
|
|||
@import "variables";
|
||||
|
||||
// the default values get overwritten by the definitions above
|
||||
@import "bulma/sass/utilities/_all";
|
||||
@import "bulma/sass/utilities/_all";
|
||||
|
||||
// this is needed so that the shared form variables are globally defined aswell
|
||||
@import "bulma/sass/form/shared";
|
||||
|
||||
// since $tablet is defined by bulma we can just define it after importing the utilities
|
||||
$mobile: math.div($tablet, 2);
|
|
@ -1,5 +1,3 @@
|
|||
@import 'colors';
|
||||
|
||||
$white: #fff;
|
||||
$black: hsl(0, 0%, 4%) !default;
|
||||
$orange: #ff851b;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
@import 'theme/all';
|
||||
@import 'utilities/all';
|
||||
@import 'components/all';
|
Reference in New Issue
Block a user
Did you put this seperately from the other style tag to prevent importing and prefixing these global styles in the scope? (possibly multiple times)
Not sure if I 100% understand the question. But I'll just try to explain why there are two style tag in this component:
the first (without
scoped
attribute) contains all global styles. The are just loaded here for the whole application.Since they are global the CSS rules inside also apply to all other components. Our target is to minimize the content of this file.
But some will always stay there. E.g. CSS resets, typo imports.
The style with the
scoped
attribute contains the styles that get scopedby the vue loader(vue-loader was in vue 2) to the current compoent via the css data attributes. I guess we could also abstract the offline stuff in its own component then these styles would be there together with the template.When compiled
by the vue-loaderboth of these kind of styles will get thecompiled output of the scss defined in the
additionalData
in the vite.config.js which should only be variables and mixins (so it should not result in rendered CSS code). With this "trick" (I think its kind of the way to go for vue) every component has all the global variables available. In reality every component imports them again on their own.In general I tried to change as few as possible with the styles. But for example below we could just unindent all styles and decrease the complexitiy by decreasing the specifity:
Even if there is an
<h1>
somewhere else in the app: just the one in this component should be styles by this rule because of the scoping =)Almost every component in this pull request could be unindented in this way.
The
font-weight: 700 !important;
is a topic in itself :)Thanks for clarifying!
Doesn't that bloat all component stylesheets because they all contain all global stylesheets? Or is vite smart enough to figure that out and create small bundles?
We should clean the stylesheets up at some point. They've all grown over time ("historisch gewachsen") 🙂 I think that's better for another PR though because this one is already quite big.