Skip to content

Commit

Permalink
docs: update docs with SASS @use info
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Oct 19, 2024
1 parent 50922a3 commit 6be34f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
10 changes: 4 additions & 6 deletions docs/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ import '@slickgrid-universal/common/dist/styles/css/slickgrid-theme-bootstrap.cs
You could also compile the SASS files with your own customization, for that simply take any of the [_variables.scss](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/_variables.scss) (without the `!default` flag) variable from the file and make sure to import the Bootstrap Theme afterward. For example, you could modify your `style.scss` with the following changes:

```scss
/* for example, let's change the mouse hover color */
$cell-odd-background-color: lightyellow;
$row-mouse-hover-color: lightgreen;

/* make sure to add the @use the SlickGrid Bootstrap Theme AFTER the variables changes */
@use '../node_modules/@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss';
@use '../node_modules/@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss' with (
$cell-odd-background-color: lightyellow,
$row-mouse-hover-color: lightgreen
);
```

### 3. Include it in your App
Expand Down
26 changes: 12 additions & 14 deletions docs/styling/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ The Material & Salesforce Themes are using SVGs internally for the icons used by

##### with SASS
```scss
/* change any SASS variables before loading the theme */
$slick-primary-color: green;
$slick-cell-odd-background-color: lightyellow;
$slick-row-mouse-hover-color: lightgreen;

/* style.scss */
@use '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss';
@use '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss' with (
$slick-primary-color: green,
$slick-cell-odd-background-color: lightyellow,
$slick-row-mouse-hover-color: lightgreen
);

// or other Themes
// @use '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-material.scss';
Expand Down Expand Up @@ -71,14 +70,13 @@ You could use Custom SVGs and create your own Theme and/or a different set of SV

##### with SVG
```scss
$slick-primary-color: blue;
$slick-icon-group-color: $slick-primary-color;
$slick-icon-group-collapsed-svg-path: "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";
$slick-icon-group-expanded-svg-path: "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z";
$slick-icon-group-font-size: 13px;

// then on the last line, load the Theme that you wish to override
@use '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss';
@use '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss' with (
$slick-primary-color: blue,
$slick-icon-group-color: $slick-primary-color,
$slick-icon-group-collapsed-svg-path: "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",
$slick-icon-group-expanded-svg-path: "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",
$slick-icon-group-font-size: 13px
);
```

> **Note** since the SVG are generated by a SASS function, you can easily override an SVG path in SASS but that is not the case with CSS variable. We still have a way to override an SVG via CSS variable but it requires to override the entire SVG content (not just its path) as can be seen below (also notice that the CSS variable is named without the `"-path"` suffix and also note that the URL must be encoded)
Expand Down

0 comments on commit 6be34f8

Please sign in to comment.