Skip to content

Commit

Permalink
Add pe commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Miklos Szanyi committed Jun 14, 2021
1 parent 97ce377 commit 33dab25
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 99 deletions.
1 change: 1 addition & 0 deletions .cache/.stylelintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/Users/miklos/Documents/GitHub/grid-bootstrap/scss/_utilities.scss":"1","/Users/miklos/Documents/GitHub/grid-bootstrap/scss/_variables.scss":"2","/Users/miklos/Documents/GitHub/grid-bootstrap/scss/grid-bootstrap-import.scss":"3","/Users/miklos/Documents/GitHub/grid-bootstrap/scss/grid-bootstrap.scss":"4","/Users/miklos/Documents/GitHub/grid-bootstrap/scss/grid/_grid.scss":"5"},{"size":957,"mtime":1623703707460,"hashOfConfig":"6"},{"size":73,"mtime":1623703707460,"hashOfConfig":"6"},{"size":63,"mtime":1623703707460,"hashOfConfig":"6"},{"size":216,"mtime":1623703707460,"hashOfConfig":"6"},{"size":2146,"mtime":1623703707477,"hashOfConfig":"6"},"16giffr"]
9 changes: 8 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"extends": "stylelint-config-standard"
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss"
],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true
}
}
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"start": "npm run watch",
"css": "npm-run-all css-compile-main css-compress",
"css-lint": "stylelint \"scss/**/*.scss\" --cache --cache-location .cache/.stylelintcache",
"css-lint": "stylelint \"scss/**/*.scss\" --syntax scss --cache --cache-location .cache/.stylelintcache",
"css-lint:fix": "stylelint \"scss/**/*.scss\" --syntax scss --cache --cache-location .cache/.stylelintcache --fix",
"css-compile-main": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/grid-bootstrap.scss dist/css/grid-bootstrap.css",
"css-compress": "uglifycss dist/css/grid-bootstrap.css --output dist/css/grid-bootstrap.min.css",
"watch": "nodemon --watch scss/ --ext scss --exec \"npm run css\"",
Expand All @@ -34,15 +35,28 @@
"homepage": "https://github.com/swingerman/grid-bootstrap#readme",
"devDependencies": {
"css-lint": "^1.0.1",
"husky": "^6.0.0",
"node-sass": "^4.12.0",
"nodemon": "^1.19.0",
"npm-run-all": "^4.1.5",
"postcss-cli": "^6.1.2",
"stylelint": "^10.0.1",
"stylelint-config-standard": "^18.3.0",
"stylelint-scss": "^3.19.0",
"uglifycss": "^0.0.29"
},
"dependencies": {
"bootstrap": "^4.3.1"
},
"lint-staged": {
"src/**/*.scss": [
"stylelint --syntax scss --fix",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
55 changes: 29 additions & 26 deletions scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,40 @@
$spacingMap: (grid-column-gap: cg, grid-row-gap: rg);
// justify
$justify: (start, end, center, stretch);

@each $val in $justify {
.justify-self-#{$val} {
justify-self: $val !important;
}
.justify-self-#{$val} {
justify-self: $val !important;
}
}

// Generate breakpoint based variants
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
// grid spacing
@each $prop,
$abbrev in $spacingMap {
@each $size,
$length in $spacers {
.grid-#{$abbrev}-#{$size} {
#{$prop}: $length !important;
}
.grid-#{$abbrev}#{$infix}-#{$size} {
#{$prop}: $length !important;
}
}
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
// grid spacing
@each $prop,
$abbrev in $spacingMap {
@each $size,
$length in $spacers {
.grid-#{$abbrev}-#{$size} {
#{$prop}: $length !important;
}
// justify
@each $val in $justify {
.justify-self-#{$breakpoint}-#{$val} {
justify-self: $val !important;
}
.justify-self-#{$infix}-#{$val} {
justify-self: $val !important;
}

.grid-#{$abbrev}#{$infix}-#{$size} {
#{$prop}: $length !important;
}
}
}
}
// justify
@each $val in $justify {
.justify-self-#{$breakpoint}-#{$val} {
justify-self: $val !important;
}

.justify-self-#{$infix}-#{$val} {
justify-self: $val !important;
}
}
}
}
2 changes: 1 addition & 1 deletion scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
$max-columns: $grid-columns !default;
$max-rows: $grid-columns !default;
$max-rows: $grid-columns !default;
2 changes: 1 addition & 1 deletion scss/grid-bootstrap-import.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import 'variables';
@import 'grid/grid';
@import 'utilities';
@import 'utilities';
2 changes: 1 addition & 1 deletion scss/grid-bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
@import '../node_modules/bootstrap/scss/mixins';
@import 'variables';
@import 'grid/grid';
@import 'utilities';
@import 'utilities';
143 changes: 76 additions & 67 deletions scss/grid/_grid.scss
Original file line number Diff line number Diff line change
@@ -1,84 +1,93 @@
// Guess what...
.d-grid {
display: grid;
display: grid;
}

// Add classes based on max-columns
@for $c from 1 to $max-columns+1 {
.grid-col-start-#{$c} {
grid-column-start: $c !important;
.grid-col-start-#{$c} {
grid-column-start: $c !important;
}

.grid-col-end-#{$c} {
grid-column-end: $c !important;
}

.grid-cols-#{$c} {
-ms-grid-template-columns: repeat($c, 1fr);
grid-template-columns: repeat($c, 1fr);
}
// grid col span
.grid-cs-#{$c} {
grid-column-end: span $c !important;
}
}

@for $r from 1 to $max-rows+1 {
// grid row span
.grid-rs-#{$r} {
grid-row-end: span $r !important;
}
}

// Generate breakpoint based variants
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);

.d-#{$breakpoint}-grid {
display: grid !important;
}
.grid-col-end-#{$c} {
grid-column-end: $c !important;

.d-#{$infix}-grid {
display: grid !important;
}
.grid-cols-#{$c} {
// grid columns even
@for $c from 1 to $max-columns+1 {
.grid-cols-#{$breakpoint}-#{$c} {
-ms-grid-template-columns: repeat($c, 1fr);
grid-template-columns: repeat($c, 1fr);
}
}
// grid col span
.grid-cs-#{$c} {
// grid column start/end responsive classes
@for $c from 1 to $max-columns+1 {
.grid-col-#{$breakpoint}-#{$c} {
grid-column: $c !important;
}

.grid-col-#{$breakpoint}-start-#{$c} {
grid-column-start: $c !important;
}

.grid-col-#{$breakpoint}-end-#{$c} {
grid-column-end: $c !important;
}
}
// grid row start/end responsive classes
@for $r from 1 to $max-rows+1 {
.grid-row-#{$breakpoint}-#{$r} {
grid-row: $r !important;
}

.grid-row-#{$breakpoint}-start-#{$r} {
grid-row-start: $r !important;
}

.grid-row-#{$breakpoint}-end-#{$r} {
grid-row-end: $r !important;
}
}
// grid col/row span responsive classes
@for $c from 1 to $max-columns+1 {
.grid-cs-#{$breakpoint}-#{$c} {
grid-column-end: span $c !important;
}
}
}

@for $r from 1 to $max-rows+1 {
// grid row span
.grid-rs-#{$r} {
@for $r from 1 to $max-rows+1 {
.grid-rs-#{$breakpoint}-#{$r} {
grid-row-end: span $r !important;
}
}
}
}

// Generate breakpoint based variants
@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
.d-#{$breakpoint}-grid {
display: grid !important;
}
.d-#{$infix}-grid {
display: grid !important;
}
// grid columns even
@for $c from 1 to $max-columns+1 {
.grid-cols-#{$breakpoint}-#{$c} {
-ms-grid-template-columns: repeat($c, 1fr);
grid-template-columns: repeat($c, 1fr);
}
}
// grid column start/end responsive classes
@for $c from 1 to $max-columns+1 {
.grid-col-#{$breakpoint}-#{$c} {
grid-column: $c !important;
}
.grid-col-#{$breakpoint}-start-#{$c} {
grid-column-start: $c !important;
}
.grid-col-#{$breakpoint}-end-#{$c} {
grid-column-end: $c !important;
}
}
// grid row start/end responsive classes
@for $r from 1 to $max-rows+1 {
.grid-row-#{$breakpoint}-#{$r} {
grid-row: $r !important;
}
.grid-row-#{$breakpoint}-start-#{$r} {
grid-row-start: $r !important;
}
.grid-row-#{$breakpoint}-end-#{$r} {
grid-row-end: $r !important;
}
}
// grid col/row span responsive classes
@for $c from 1 to $max-columns+1 {
.grid-cs-#{$breakpoint}-#{$c} {
grid-column-end: span $c !important;
}
}
@for $r from 1 to $max-rows+1 {
.grid-rs-#{$breakpoint}-#{$r} {
grid-row-end: span $r !important;
}
}
}
}
31 changes: 30 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,11 @@ css-lint@^1.0.1:
merge "^1.2.0"
util "^0.10.3"

cssesc@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==

currently-unhandled@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea"
Expand Down Expand Up @@ -2041,6 +2046,11 @@ http-signature@~1.2.0:
jsprim "^1.2.2"
sshpk "^1.7.0"

husky@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e"
integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==

ignore-by-default@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
Expand Down Expand Up @@ -3908,6 +3918,14 @@ postcss-selector-parser@^3.1.0:
indexes-of "^1.0.1"
uniq "^1.0.1"

postcss-selector-parser@^6.0.2:
version "6.0.6"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz#2c5bba8174ac2f6981ab631a42ab0ee54af332ea"
integrity sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==
dependencies:
cssesc "^3.0.0"
util-deprecate "^1.0.2"

postcss-syntax@^0.36.2:
version "0.36.2"
resolved "https://registry.yarnpkg.com/postcss-syntax/-/postcss-syntax-0.36.2.tgz#f08578c7d95834574e5593a82dfbfa8afae3b51c"
Expand Down Expand Up @@ -4732,6 +4750,17 @@ stylelint-config-standard@^18.3.0:
dependencies:
stylelint-config-recommended "^2.2.0"

stylelint-scss@^3.19.0:
version "3.19.0"
resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-3.19.0.tgz#528006d5a4c5a0f1f4d709b02fd3f626ed66d742"
integrity sha512-Ic5bsmpS4wVucOw44doC1Yi9f5qbeVL4wPFiEOaUElgsOuLEN6Ofn/krKI8BeNL2gAn53Zu+IcVV4E345r6rBw==
dependencies:
lodash "^4.17.15"
postcss-media-query-parser "^0.2.3"
postcss-resolve-nested-selector "^0.1.1"
postcss-selector-parser "^6.0.2"
postcss-value-parser "^4.1.0"

stylelint@^10.0.1:
version "10.1.0"
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-10.1.0.tgz#1bc4c4ce878107e7c396b19226d91ba28268911a"
Expand Down Expand Up @@ -5162,7 +5191,7 @@ user-home@^2.0.0:
dependencies:
os-homedir "^1.0.0"

util-deprecate@^1.0.1, util-deprecate@~1.0.1:
util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
Expand Down

0 comments on commit 33dab25

Please sign in to comment.