mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Apply suggestions from code review
Co-authored-by: Chauncey McAskill <chauncey@mcaskill.ca>
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* Uses [SVG Mixer] for processing SVG files and generating spritesheets.
|
* Uses [SVG Mixer] for processing SVG files and generating spritesheets.
|
||||||
* Uses [ITCSS] for a sane and scalable CSS architecture.
|
* Uses [ITCSS] for a sane and scalable CSS architecture.
|
||||||
* Uses [Locomotive Scroll] for smooth scrolling with parallax effects.
|
* Uses [Locomotive Scroll] for smooth scrolling with parallax effects.
|
||||||
* Uses a custom [Grid System](docs/grid.md) for layout creation.
|
* Uses a custom [grid system](docs/grid.md) for layout creation.
|
||||||
|
|
||||||
Learn more about [languages and technologies](docs/technologies.md).
|
Learn more about [languages and technologies](docs/technologies.md).
|
||||||
|
|
||||||
|
|||||||
77
docs/grid.md
77
docs/grid.md
@@ -27,63 +27,64 @@ The generation of columns adds a lot of styles in the css output file. To solve
|
|||||||
|
|
||||||
Depending on your project, you will need to specify all the files that will include the Grid System classes. These files will be parsed by [PurgeCSS] and then a "cleaned" css file will be generated. The styles should also compile everytime the following listed files are changed.
|
Depending on your project, you will need to specify all the files that will include the Grid System classes. These files will be parsed by [PurgeCSS] and then a "cleaned" css file will be generated. The styles should also compile everytime the following listed files are changed.
|
||||||
|
|
||||||
```json
|
Example of a Charcoal project:
|
||||||
// Charcoal project example
|
|
||||||
|
```jsonc
|
||||||
"purgeCSS": {
|
"purgeCSS": {
|
||||||
"content": [
|
"content": [
|
||||||
"./www/**/*.html",
|
|
||||||
"./views/app/template/**/*.mustache",
|
"./views/app/template/**/*.mustache",
|
||||||
"./src/App/Template/*.php",
|
"./src/App/Template/*.php",
|
||||||
"./assets/scripts/**/*" // use case: el.classList.add('u-gc-1/2')
|
"./assets/scripts/**/*" // use case: `el.classList.add('u-gc-1/2')`
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The first step is to set intial SCSS values in the following files :
|
The first step is to set intial SCSS values in the following files :
|
||||||
|
|
||||||
- [`config.scss`](../assets/styles/settings/_config.scss)
|
- [`settings/_config.scss`](../assets/styles/settings/_config.scss)
|
||||||
```scss
|
|
||||||
// Grid
|
|
||||||
// ==========================================================================
|
|
||||||
$base-column-nb: 12;
|
|
||||||
$base-column-gap: $unit-small;
|
|
||||||
```
|
|
||||||
|
|
||||||
You can create multiple column layouts depending on media queries
|
|
||||||
|
|
||||||
- [`grid.scss`](../assets/styles/objects/_grid.scss)
|
|
||||||
```scss
|
|
||||||
.o-grid {
|
|
||||||
display: grid;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
list-style: none;
|
|
||||||
|
|
||||||
|
```scss
|
||||||
|
// Grid
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Cols
|
$base-column-nb: 12;
|
||||||
// ==========================================================================
|
$base-column-gap: $unit-small;
|
||||||
&.-col-#{$base-column-nb} {
|
```
|
||||||
grid-template-columns: repeat(#{$base-column-nb}, 1fr);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.-col-4 {
|
You can create multiple column layouts depending on media queries.
|
||||||
grid-template-columns: repeat(4, 1fr);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.-col-#{$base-column-nb}\@from-medium {
|
- [`objects/_grid.scss`](../assets/styles/objects/_grid.scss)
|
||||||
@media (min-width: $from-medium) {
|
|
||||||
|
```scss
|
||||||
|
.o-grid {
|
||||||
|
display: grid;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
// Cols
|
||||||
|
// ==========================================================================
|
||||||
|
&.-col-#{$base-column-nb} {
|
||||||
grid-template-columns: repeat(#{$base-column-nb}, 1fr);
|
grid-template-columns: repeat(#{$base-column-nb}, 1fr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
...
|
&.-col-4 {
|
||||||
```
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.-col-#{$base-column-nb}\@from-medium {
|
||||||
|
@media (min-width: $from-medium) {
|
||||||
|
grid-template-columns: repeat(#{$base-column-nb}, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// …
|
||||||
|
```
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
Here is an example of a layout that has 4 columns `>=999px` and 12 columns `<1000px`
|
The following layout has 4 columns at `>=999px` and 12 columns at `<1000px`.
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<div class="o-container">
|
<div class="o-container">
|
||||||
@@ -109,4 +110,4 @@ Here is an example of a layout that has 4 columns `>=999px` and 12 columns `<100
|
|||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
|
|
||||||
[purgecss]: https://purgecss.com/
|
[PurgeCSS]: https://purgecss.com/
|
||||||
|
|||||||
@@ -60,8 +60,6 @@
|
|||||||
"purgeCSS": {
|
"purgeCSS": {
|
||||||
"content": [
|
"content": [
|
||||||
"./www/**/*.html",
|
"./www/**/*.html",
|
||||||
"./views/app/template/**/*.mustache",
|
|
||||||
"./src/App/Template/*.php",
|
|
||||||
"./assets/scripts/**/*"
|
"./assets/scripts/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html class="is-loading" lang="en" data-page="grid">
|
<html class="is-loading" lang="en" data-page="grid">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Locomotive Boilerplate</title>
|
<title>Locomotive Boilerplate</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user