Skip to content

Commit

Permalink
revert use of @use, bump version to v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
myty committed Sep 22, 2024
1 parent 0fe29bc commit 6e443c5
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 141 deletions.
28 changes: 14 additions & 14 deletions docs/index.html

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rsm-hcd/scss-grid",
"description": "Sass (scss) based grid system",
"version": "3.0.4",
"version": "3.1.0",
"homepage": "https://github.com/rsm-hcd/scss-grid#readme",
"files": [
"dist/**",
Expand Down Expand Up @@ -38,7 +38,7 @@
"watch": "sass --watch src -o dist"
},
"dependencies": {
"sass": "^1.79.1"
"sass": "^1.79.3"
},
"devDependencies": {
"cross-env": "^7.0.3",
Expand Down
4 changes: 2 additions & 2 deletions src/functions/__functions.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@use "calc-col-width";
@use "calc-gutter-width";
@import "calc-col-width";
@import "calc-gutter-width";
8 changes: 4 additions & 4 deletions src/functions/_calc-col-width.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use "sass:map";
@use "sass:math";
@use "../settings/settings";
@use "calc-gutter-width";
@import "../settings/settings";
@import "calc-gutter-width";

/// Dynamically calculate the column width within the grid
/// @param {number} $col Number of columns
Expand All @@ -10,11 +10,11 @@
/// @example scss
/// width: calc-col-width(6, $my-grid);
///
@function calc-col-width($col, $grid: settings.$grid-grid) {
@function calc-col-width($col, $grid: $grid-grid) {
$grid-cols: map.get($grid, "columns");
$col-gutter: map.get($grid, "gutter");

$width-gutter: calc-gutter-width.calc-gutter-width($col);
$width-gutter: calc-gutter-width($col);

@if ($col-gutter > 0) {
$width: math.div($col, $grid-cols);
Expand Down
6 changes: 3 additions & 3 deletions src/functions/_calc-gutter-width.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@use "sass:map";
@use "sass:math";
@use "../settings/settings";
@import "../settings/settings";

/// Dynamic calculation of gutter width based on the columns and grid
/// @param {number} $col Number of columns
/// @requires $grid-grid
@function calc-gutter-width($col) {
$grid-cols: map.get(settings.$grid-grid, "columns");
$col-gutter: map.get(settings.$grid-grid, "gutter");
$grid-cols: map.get($grid-grid, "columns");
$col-gutter: map.get($grid-grid, "gutter");
@return math.div(($grid-cols + $col) * $col-gutter, $grid-cols);
}
10 changes: 5 additions & 5 deletions src/mixins/__mixins.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "clearfix";
@use "media";
@use "push-col";
@use "span-col";
@use "collapse";
@import "clearfix";
@import "media";
@import "push-col";
@import "span-col";
@import "collapse";
4 changes: 2 additions & 2 deletions src/mixins/_collapse.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@use "sass:map";
@use "../settings/settings";
@import "../settings/settings";

/// Consume the gutters of the grid. Useful in nested layouts.
/// @requires $grid-grid
@mixin collapse {
$col-gutter: map.get(settings.$grid-grid, "gutter");
$col-gutter: map.get($grid-grid, "gutter");

margin-left: -#{$col-gutter};
margin-right: -#{$col-gutter};
Expand Down
8 changes: 4 additions & 4 deletions src/mixins/_media.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "sass:map";
@use "../settings/settings";
@import "../settings/settings";

/// Generates media query with included content.
/// @param {string} $breakpoint Named breakpoint
Expand All @@ -13,12 +13,12 @@
/// }
/// }
@mixin respond-to($breakpoint) {
@if map.has-key(settings.$breakpoints, $breakpoint) {
@media (max-width: map.get(settings.$breakpoints, $breakpoint)) {
@if map.has-key($breakpoints, $breakpoint) {
@media (max-width: map.get($breakpoints, $breakpoint)) {
@content;
}
} @else {
@warn "Unfortunately, no value could be retrieved from `#{$breakpoint}`. "
+ "Available breakpoints are: #{map.keys(settings.$breakpoints)}.";
+ "Available breakpoints are: #{map.keys($breakpoints)}.";
}
}
4 changes: 2 additions & 2 deletions src/mixins/_push-col.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use "sass:map";
@use "sass:math";
@use "../settings/settings";
@import "../settings/settings";

/// Push or pull a grid column by manipulating its left margin
/// @param {number} $col Number of columns to shift
Expand All @@ -13,7 +13,7 @@
/// @include push-col(0);
/// }
/// }
@mixin push-col($col, $grid: settings.$grid-grid) {
@mixin push-col($col, $grid: $grid-grid) {
$grid-cols: map.get($grid, "columns");
margin-left: math.div($col, $grid-cols);
}
14 changes: 7 additions & 7 deletions src/mixins/_span-col.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use "sass:map";
@use "../functions/calc-col-width";
@use "../settings/settings";
@import "../functions/calc-col-width";
@import "../settings/settings";

/// Create a column spanning over multiple columns in a defined grid
/// @param {number} $col Number of columns to span across
Expand All @@ -11,13 +11,13 @@
/// &.-span-one {
/// @include span-col(1);
/// }
@mixin span-col($col, $grid: settings.$grid-grid) {
width: calc-col-width.calc-col-width($col, $grid);
@mixin span-col($col, $grid: $grid-grid) {
width: calc-col-width($col, $grid);
min-width: 0;
-webkit-box-flex: 0;
-ms-flex: 0 0 calc-col-width.calc-col-width($col, $grid);
flex: 0 0 calc-col-width.calc-col-width($col, $grid);
max-width: calc-col-width.calc-col-width($col, $grid);
-ms-flex: 0 0 calc-col-width($col, $grid);
flex: 0 0 calc-col-width($col, $grid);
max-width: calc-col-width($col, $grid);
width: 100%;
margin-left: map.get($grid, "gutter");
}
Loading

0 comments on commit 6e443c5

Please sign in to comment.