Skip to content

Commit

Permalink
add custom styling
Browse files Browse the repository at this point in the history
  • Loading branch information
pehaa committed Jun 30, 2020
1 parent 7d909df commit 799f4b0
Show file tree
Hide file tree
Showing 9 changed files with 11,218 additions and 15 deletions.
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"liveSassCompile.settings.formats": [
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
},
{
"extensionName": ".min.css",
"format": "compressed",
"savePath": "/dist/css"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**",
"scss/**"
],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": ["> 1%", "last 2 versions"]
}
204 changes: 203 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,205 @@
# alyra-bootstrap-challenge
# Alyra Bootstrap Challenge

Custom SASS build

[demo](https://alyra-bootstrap-chlng.netlify.app/)

## Step 0

Créer un dossier custom

```bash
mkdir custom
```

Ajouter un fichier

```bash
touch custom/mybootstrap.scss
```

## Step 1

Copier le dossier scss depuis les fichier source de Bootstrap 5

## Step 2

Configurer Sass Live Compiler

- créer un dossier `.vscode`
- créer un fichier `settings.json`

```
{
"liveSassCompile.settings.formats":[
{
"format": "expanded",
"extensionName": ".css",
"savePath": "/css"
},
{
"extensionName": ".min.css",
"format": "compressed",
"savePath": "/dist/css"
}
],
"liveSassCompile.settings.excludeList": [
"**/node_modules/**",
".vscode/**",
"scss/**"
],
"liveSassCompile.settings.generateMap": true,
"liveSassCompile.settings.autoprefix": [
"> 1%",
"last 2 versions"
]
}
```

## Step 3

Lancer `Watch Sass` pour vérifier la configuration.

```scss
// custom/mybootstrap.scss
body {
color: red;
}
```

```bash
├── README.md
├── blog-single.html
├── category.html
├── contact.html
├── css
│ ├── mybootstrap.css
│ └── mybootstrap.css.map
├── custom
│ └── mybootstrap.scss
├── dist
│ └── css
│ ├── mybootstrap.min.css
│ └── mybootstrap.min.css.map
├── images
├── index.html
├── screenshots
├── scss
└── style.css
```

## Step 4

Dans les fichiers `.html` remplacer le lien vers le css de bootstrap par le lien vers `dist/css/mybootstrap.min.css`

before :

```html
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
integrity="sha384-r4NyP46KrjDleawBgD5tp8Y7UzmLA05oM1iAEQ17CSuDqnUK2+k9luXQOfXJCJ4I"
crossorigin="anonymous"
/>
```

after:

```html
<link rel="stylesheet" href="dist/css/mybootstrap.min.css" />
```

## Step 5

Le fichier principal scss de bootstrap est le `bootstrap.scss` dans le dossier `scss`

Il n'est pas une bonne pratique de modifier les fichier sources. C'est un règle générale.

Au lieu de le modifier, nous allons copier son contenu et le coller dans notre fichier `scss/bootstrap.scss`

Il nous restera à corriger les chemins vers les fichiers partials.

```scss
// custom/mybootstrap.scss
@import "../scss/functions";
@import "../scss/variables";
@import "../scss/mixins";
@import "../scss/utilities";
...
```

Astuce: vous pouvez vous servir de la fonctionnalité "Replace" de VSCode Alt+Cmd/Ctrl+F

cherche : @import "
replace with : @import "../scss/

![](https://wptemplates.pehaa.com/assets/alyra/replace.png)

## Step 6

Commentez les partials dont vous vous ne servez pas.

```scss
// custom/mybootstrap.scss
...
// @import "../scss/toasts";
// @import "../scss/modal";
// @import "../scss/tooltip";
// @import "../scss/popover";
@import "../scss/carousel";
// @import "../scss/spinners";
...

```

## Variables

Ouvrer [SassMeister](https://www.sassmeister.com/)

** Quelle couleur prendra body ? **

Exemple 1 :

```scss
$color: orange;
$color: red;

body {
background: $color;
}
```

Exemple 2 :

```scss
$color: orange;
$color: red !default;

body {
background: $color;
}
```

Exemple 2 :

```scss
$color: orange;
$color: red !default;
$colot: tomato;

body {
background: $color;
}
```

## Step 7

En haut du fichier `mybootstrap.scss` ajouter

```scss
$secondary: indigo;
$dark: black;
$light: lavender;
$danger: hotpink;
$box-shadow: 0 2px 10px lavender;
```
5 changes: 1 addition & 4 deletions category.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<head>
<title>Blog Template</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css"
Expand Down
Loading

0 comments on commit 799f4b0

Please sign in to comment.