Skip to content

Commit ff804af

Browse files
committed
refactor: migrate to Sass modules and CSS logical properties and values
1 parent 10252d5 commit ff804af

File tree

7 files changed

+73
-102
lines changed

7 files changed

+73
-102
lines changed

src/App.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ onBeforeMount(() => {
3636

3737
<style lang="scss">
3838
// Import Main styles for this application
39-
@import 'styles/style';
39+
@use 'styles/style';
4040
// We use those styles to show code examples, you should remove them in your application.
41-
@import 'styles/examples';
41+
@use 'styles/examples';
4242
</style>

src/styles/_custom.scss

-1
This file was deleted.

src/styles/_theme.scss

-64
This file was deleted.

src/styles/_variables.scss

-5
This file was deleted.

src/styles/examples.scss

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
/* stylelint-disable declaration-no-important, scss/selector-no-redundant-nesting-selector */
2-
3-
$enable-deprecation-messages: false !default;
4-
5-
@import "@coreui/coreui/scss/functions";
6-
@import "@coreui/coreui/scss/variables";
7-
@import "@coreui/coreui/scss/mixins";
1+
/* stylelint-disable scss/selector-no-redundant-nesting-selector */
2+
@use "@coreui/coreui/scss/variables" as *;
3+
@use "@coreui/coreui/scss/mixins/breakpoints" as *;
4+
@use "@coreui/coreui/scss/mixins/color-mode" as *;
85

96
.example {
107
&:not(:first-child) {
@@ -110,10 +107,8 @@ $enable-deprecation-messages: false !default;
110107
}
111108
}
112109

113-
@if $enable-dark-mode {
114-
@include color-mode(dark) {
115-
.example .tab-content {
116-
background-color: var(--#{$prefix}secondary-bg) !important;
117-
}
110+
@include color-mode(dark) {
111+
.example .tab-content {
112+
background-color: var(--#{$prefix}secondary-bg) !important;
118113
}
119-
}
114+
}

src/styles/style.scss

+63-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,67 @@
1-
// If you want to override variables do it here
2-
@import "variables";
1+
@use "@coreui/coreui/scss/coreui" as * with (
2+
$enable-deprecation-messages: false
3+
);
4+
@use "@coreui/chartjs/scss/coreui-chartjs";
5+
@use "vendors/simplebar";
36

4-
// Import styles
5-
@import "@coreui/coreui/scss/coreui";
6-
@import "@coreui/chartjs/scss/coreui-chartjs";
7+
body {
8+
background-color: var(--cui-tertiary-bg);
9+
}
710

8-
// Vendors
9-
@import "vendors/simplebar";
11+
.wrapper {
12+
width: 100%;
13+
padding-inline: var(--cui-sidebar-occupy-start, 0) var(--cui-sidebar-occupy-end, 0);
14+
will-change: auto;
15+
@include transition(padding .15s);
16+
}
1017

11-
// Custom styles for this theme
12-
@import "theme";
18+
.header > .container-fluid,
19+
.sidebar-header {
20+
min-height: calc(4rem + 1px); // stylelint-disable-line function-disallowed-list
21+
}
1322

14-
// If you want to add custom CSS you can put it here
15-
@import "custom";
23+
.sidebar-brand-full {
24+
margin-left: 3px;
25+
}
26+
27+
.sidebar-header {
28+
.nav-underline-border {
29+
--cui-nav-underline-border-link-padding-x: 1rem;
30+
--cui-nav-underline-border-gap: 0;
31+
}
32+
33+
.nav-link {
34+
display: flex;
35+
align-items: center;
36+
min-height: calc(4rem + 1px); // stylelint-disable-line function-disallowed-list
37+
}
38+
}
39+
40+
.sidebar-toggler {
41+
margin-inline-start: auto;
42+
}
43+
44+
.sidebar-narrow,
45+
.sidebar-narrow-unfoldable:not(:hover) {
46+
.sidebar-toggler {
47+
margin-inline-end: auto;
48+
}
49+
}
50+
51+
.header > .container-fluid + .container-fluid {
52+
min-height: 3rem;
53+
}
54+
55+
.footer {
56+
min-height: calc(3rem + 1px); // stylelint-disable-line function-disallowed-list
57+
}
58+
59+
@include color-mode(dark) {
60+
body {
61+
background-color: var(--cui-dark-bg-subtle);
62+
}
63+
64+
.footer {
65+
--cui-footer-bg: var(--cui-body-bg);
66+
}
67+
}

vite.config.mjs

-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ export default defineConfig(() => {
1313
autoprefixer({}), // add options if needed
1414
],
1515
},
16-
preprocessorOptions: {
17-
scss: {
18-
quietDeps: true,
19-
silenceDeprecations: ['import', 'legacy-js-api'],
20-
},
21-
},
2216
},
2317
resolve: {
2418
alias: [

0 commit comments

Comments
 (0)