Skip to content

Commit

Permalink
refactor(sass): move contains function to a separate file and updat…
Browse files Browse the repository at this point in the history
…e imports accordingly

Error:
- The `functions` and `mixins` must be in separate files.

Solution:
- Move the `contains` function from `_tools-media.scss` to a new file `_tools-contains.scss` for better separation of concerns.
- Update `tools/_tools-media.scss` to remove the `contains` function and keep only media query mixins.
- Update `styles.scss` to include the new `tools/_tools-contains.scss` file using `@forward`, allowing better separation of functions and mixins.
  • Loading branch information
beatrizsmerino committed Oct 22, 2024
1 parent f2ac117 commit c0a3504
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/assets/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@

// TOOLS
// ----------------------------------------------------------------------
@forward "tools/tools-contains";
@forward "tools/tools-media";
8 changes: 8 additions & 0 deletions src/assets/scss/tools/_tools-contains.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// TOOLS - FUNCTIONS
// CONTAINS
// =================================================
@use "sass:list";

@function contains($list, $item) {
@return list.index($list, $item) != null;
}
6 changes: 1 addition & 5 deletions src/assets/scss/tools/_tools-media.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
// TOOLS - MIXINS
// MEDIA
// =================================================
@use "sass:list";
@use "sass:map";
@use "sass:math";
@use "sass:meta";
@use "../tools/tools-contains" as *;
@use "../settings/settings-breakpoints" as *;

@function contains($list, $item) {
@return list.index($list, $item) != null;
}

@mixin media($breakpoint, $rule: "max", $dimension: "width") {
$rules: "max", "min";
$dimensions: "width", "height";
Expand Down

0 comments on commit c0a3504

Please sign in to comment.