Merge pull request #1332 from hgiesel/svelteexportcontext

Shorten CSS references for `@import` or `@use`
This commit is contained in:
Damien Elmes 2021-09-06 21:10:27 +10:00 committed by GitHub
commit 6909a095d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 67 additions and 63 deletions

View File

@ -1,15 +1,15 @@
@use "ts/sass/vars";
@use "ts/sass/scrollbar";
@use "ts/sass/bootstrap-dark";
@use "vars";
@use "scrollbar";
@use "bootstrap-dark";
@import "ts/sass/base";
@import "base";
@import "ts/sass/bootstrap/alert";
@import "ts/sass/bootstrap/forms";
@import "ts/sass/bootstrap/buttons";
@import "ts/sass/bootstrap/button-group";
@import "ts/sass/bootstrap/close";
@import "ts/sass/bootstrap/grid";
@import "bootstrap/scss/alert";
@import "bootstrap/scss/forms";
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/button-group";
@import "bootstrap/scss/close";
@import "bootstrap/scss/grid";
.night-mode {
@include scrollbar.night-mode;

View File

@ -14,7 +14,10 @@ def compile_sass(group, srcs, deps = [], visibility = ["//visibility:private"]):
sourcemap = False,
deps = deps,
visibility = visibility,
include_paths = ["external/ankidesktop"],
include_paths = [
"ts/sass",
"external/ankidesktop/ts/sass",
],
)
native.filegroup(

View File

@ -34,7 +34,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</button>
<style lang="scss">
@use 'ts/sass/button-mixins' as button;
@use 'button-mixins' as button;
button {
display: flex;

View File

@ -48,7 +48,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</button>
<style lang="scss">
@use "ts/sass/button-mixins" as button;
@use "button-mixins" as button;
button {
padding: 0;

View File

@ -49,7 +49,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</button>
<style lang="scss">
@use "ts/sass/button-mixins" as button;
@use "button-mixins" as button;
button {
padding: 0 calc(var(--buttons-size) / 3);

View File

@ -39,7 +39,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</select>
<style lang="scss">
@use "ts/sass/button-mixins" as button;
@use "button-mixins" as button;
select {
height: var(--buttons-size);

View File

@ -1,5 +1,5 @@
@use 'ts/sass/core';
@use 'ts/sass/scrollbar';
@use 'core';
@use 'scrollbar';
.night-mode {
@include scrollbar.night-mode;

View File

@ -24,8 +24,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</select>
<style lang="scss">
@use "ts/sass/night-mode" as nightmode;
@use "ts/sass/button-mixins" as button;
@use "night-mode" as nightmode;
@use "button-mixins" as button;
.nightMode {
@include nightmode.input;

View File

@ -34,7 +34,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/>
<style lang="scss">
@use "ts/sass/night-mode" as nightmode;
@use "night-mode" as nightmode;
.nightMode {
@include nightmode.input;

View File

@ -32,7 +32,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/>
<style lang="scss">
@use "ts/sass/night-mode" as nightmode;
@use "night-mode" as nightmode;
.nightMode {
@include nightmode.input;

View File

@ -28,7 +28,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/>
<style lang="scss">
@use "ts/sass/night-mode" as nightmode;
@use "night-mode" as nightmode;
.nightMode {
@include nightmode.input;

View File

@ -96,7 +96,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</div>
<style lang="scss">
@use "ts/sass/night-mode" as nightmode;
@use "night-mode" as nightmode;
.nightMode {
@include nightmode.input;

View File

@ -2,22 +2,22 @@ $tooltip-padding-y: 0.45rem;
$tooltip-padding-x: 0.65rem;
$tooltip-max-width: 300px;
@use "ts/sass/vars";
@use "ts/sass/scrollbar";
@use "vars";
@use "scrollbar";
@import "ts/sass/base";
@import "ts/sass/bootstrap/containers";
@import "ts/sass/bootstrap/grid";
@import "ts/sass/bootstrap/dropdown";
@import "ts/sass/bootstrap/forms";
@import "ts/sass/bootstrap/buttons";
@import "ts/sass/bootstrap/button-group";
@import "ts/sass/bootstrap/transitions";
@import "ts/sass/bootstrap/modal";
@import "ts/sass/bootstrap/close";
@import "ts/sass/bootstrap/alert";
@import "ts/sass/bootstrap/tooltip";
@import "ts/sass/bootstrap/badge";
@import "base";
@import "bootstrap/scss/containers";
@import "bootstrap/scss/grid";
@import "bootstrap/scss/dropdown";
@import "bootstrap/scss/forms";
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/button-group";
@import "bootstrap/scss/transitions";
@import "bootstrap/scss/modal";
@import "bootstrap/scss/close";
@import "bootstrap/scss/alert";
@import "bootstrap/scss/tooltip";
@import "bootstrap/scss/badge";
.night-mode {
@include scrollbar.night-mode;

View File

@ -1,9 +1,9 @@
@import "ts/sass/bootstrap/functions";
@import "ts/sass/bootstrap/variables";
@import "ts/sass/bootstrap/mixins";
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/mixins";
$btn-disabled-opacity: 0.4;
@import "ts/sass/bootstrap/buttons";
@import "ts/sass/bootstrap/button-group";
@import "ts/sass/bootstrap/dropdown";
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/button-group";
@import "bootstrap/scss/dropdown";

View File

@ -1,4 +1,4 @@
@use 'ts/sass/scrollbar';
@use 'scrollbar';
anki-editable {
display: block;
@ -37,9 +37,9 @@ img.drawing {
display: none;
}
@import "ts/sass/codemirror/lib/codemirror";
@import "ts/sass/codemirror/theme/monokai";
@import "ts/sass/codemirror/addon/fold/foldgutter";
@import "codemirror/lib/codemirror";
@import "codemirror/theme/monokai";
@import "codemirror/addon/fold/foldgutter";
.CodeMirror {
height: auto;

View File

@ -1,8 +1,8 @@
/* Copyright: Ankitects Pty Ltd and contributors
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
@use 'ts/sass/base';
@use 'ts/sass/scrollbar';
@use 'base';
@use 'scrollbar';
.nightMode {
@include scrollbar.night-mode;

View File

@ -1,5 +1,5 @@
@use 'ts/sass/base';
@use 'ts/sass/scrollbar';
@use 'base';
@use 'scrollbar';
.night-mode {
@include scrollbar.night-mode;

1
ts/sass/anki Symbolic link
View File

@ -0,0 +1 @@
.

View File

@ -19,8 +19,8 @@ $utilities: (
),
);
@import "ts/sass/bootstrap/bootstrap-reboot";
@import "ts/sass/bootstrap/bootstrap-utilities";
@import "bootstrap/scss/bootstrap-reboot";
@import "bootstrap/scss/bootstrap-utilities";
/* Bootstrap "extensions" */
.flex-basis-100 {

View File

@ -9,7 +9,6 @@ vendor_js_lib(
],
base = "external/npm/node_modules/bootstrap/",
pkg = pkg_from_name("bootstrap"),
strip_prefix = "scss/",
visibility = ["//visibility:private"],
)

View File

@ -1,5 +1,5 @@
@import "ts/sass/bootstrap/functions";
@import "ts/sass/bootstrap/variables";
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@mixin btn-border-radius {
border-top-left-radius: var(--border-left-radius);

View File

@ -93,7 +93,7 @@ def svelte_check(name = "svelte_check", srcs = []):
"//ts/lib",
"@npm//sass",
] + srcs,
env = {"SASS_PATH": "$(rootpath //ts:tsconfig.json)/../.."},
env = {"SASS_PATH": "ts/sass"},
# a lack of sandboxing on Windows breaks the local svelte_check
# tests, so we need to disable them on Windows for now
target_compatible_with = select({

View File

@ -153,13 +153,14 @@ async function writeJs(
const preprocessOptions = preprocess({
scss: {
includePaths: [
binDir,
genDir,
"ts/sass",
`${binDir}/ts/sass`,
`${genDir}/ts/sass`,
// a nasty hack to ensure ts/sass/... resolves correctly
// when invoked from an external workspace
binDir + "/external/ankidesktop",
genDir + "/external/ankidesktop",
binDir + "/../../../external/ankidesktop",
`${binDir}/external/ankidesktop/ts/sass`,
`${genDir}/external/ankidesktop/ts/sass`,
`${binDir}/../../../external/ankidesktop/ts/sass`,
],
},
});