Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce WPCS #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.git
/.github
/node_modules
/vendor
/.distignore
/.editorconfig
/.gitignore
/.stylelintrc.json
/composer.json
/composer.lock
/package.json
/package-lock.json
/phpcs.xml
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
20 changes: 12 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: deploy
on: [push]
on:
push:
branches:
- main
jobs:
run:
name: deploy
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
# Compile CSS
- name: Compile style CSS
uses: gha-utilities/sass-build@v0.2.5
uses: gha-utilities/sass-build@v0.6.0
with:
source: assets/scss/style.scss
destination: style.css
outputStyle: expanded
- name: Compile style CSS compressed
uses: gha-utilities/sass-build@v0.2.5
uses: gha-utilities/sass-build@v0.6.0
with:
source: assets/scss/style.scss
destination: style.min.css
Expand All @@ -26,5 +28,7 @@ jobs:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
# Transfer file to remote server
- run: ssh ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} "mkdir -p ${{ secrets.REMOTE_PATH_BASE }}"
- run: rsync -ahv * ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_PATH_BASE }}
- name: Deploy
run: |
ssh ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} "mkdir -p ${{ secrets.REMOTE_PATH_BASE }}"
rsync -ahv --exclude-from="$GITHUB_WORKSPACE/.distignore" --delete-excluded "$GITHUB_WORKSPACE/" ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_PATH_BASE }}
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests
on: [push, pull_request]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: composer
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Code style checks for PHP
run: |
composer install
composer lint-php
- name: Code style checks for SCSS
run: |
npm ci
npm run lint-scss
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.idea
/*.css
/node_modules
/vendor
7 changes: 7 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@wordpress/stylelint-config/scss",
"rules": {
"no-descending-specificity": null,
"value-keyword-case": null
}
}
2 changes: 1 addition & 1 deletion assets/scss/elements/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ input[type="submit"],
#page #infinite-handle button {
background-color: $color__link;
font-family: $font__family-body;

&:active,
&:focus,
&:hover {
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/elements/_elements.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import 'buttons';
@import "buttons";
16 changes: 9 additions & 7 deletions assets/scss/layout/_blocks.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.wp-block-columns {
flex-wrap: wrap;

@media (min-width: 500px) {
flex-wrap: nowrap;
}

&.has-4-columns {

> .wp-block-column {
flex-basis: 50%;

@media (min-width: 500px) {
flex: 0 0 25%;
}
Expand All @@ -21,19 +22,20 @@
}

.real-people {

&.real-people { // needs to override common.css from Atomic Blocks
display: flex;
}

.wp-block-column {
width: auto;
}

.wp-block-image {
margin: 0 auto;
padding: 5px;
}

img {
border-radius: 50%;
display: block;
Expand All @@ -42,7 +44,7 @@
margin: 0 auto;
width: 90px;
}

+ h1,
+ h2,
+ h3,
Expand Down
2 changes: 1 addition & 1 deletion assets/scss/layout/_blog.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.entry-content .meta-list a {
box-shadow: inset 0 -1px 0 $color__link;
color: $color__link;

&:hover {
box-shadow: inset 0 -2px 0 $color__link;
}
Expand Down
10 changes: 6 additions & 4 deletions assets/scss/layout/_font-face.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
font-family: "Fira Sans";
font-style: normal;
font-weight: 400;
src: local('Fira Sans Regular'), local('FiraSans-Regular'),
url('assets/fonts/fira-sans-v8-latin-regular.woff2') format('woff2'),
url('assets/fonts/fira-sans-v8-latin-regular.woff') format('woff');
}
src:
local("Fira Sans Regular"),
local("FiraSans-Regular"),
url(assets/fonts/fira-sans-v8-latin-regular.woff2) format("woff2"),
url(assets/fonts/fira-sans-v8-latin-regular.woff) format("woff");
}
29 changes: 16 additions & 13 deletions assets/scss/layout/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
@use "sass:color";

.site-footer {
background-color: darken($color__header-background, 5);
background-color: color.adjust($color__header-background, $lightness: -5%);
color: $color__header-link;
padding-bottom: 40px;

a,
.widget-title {
color: $color__header-link;
}

a:hover {
color: $color__header-link-active;
}

input[type="text"] {
background-color: darken($color__header-background, 10);
border-color: darken($color__header-background, 15);
background-color: color.adjust($color__header-background, $lightness: -10%);
border-color: color.adjust($color__header-background, $lightness: -15%);

&:active,
&:focus,
&:hover {
border-color: darken($color__header-background, 25);
box-shadow: inset 0 0 4px darken($color__header-background, 15);
border-color: color.adjust($color__header-background, $lightness: -25%);
box-shadow: inset 0 0 4px color.adjust($color__header-background, $lightness: -15%);
color: $color__header-link;
}
}

.searchform .searchsubmit {
color: $color__header-link;

&:active,
&:focus,
&:hover {
background-color: darken($color__header-background, 15) !important;
background-color: color.adjust($color__header-background, $lightness: -15%) !important;
box-shadow: none;
}
}
}

.footer-widgets {

.footer-column {
padding-top: 40px;
}

+ .footer-bottom {
border-top: 0;
padding-top: 0;
Expand Down
8 changes: 5 additions & 3 deletions assets/scss/layout/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ p,
}

.entry-content {

ol,
ul {
margin-left: 0;
margin-bottom: 2.4em;
}

p a {
box-shadow: inset 0 -1px 0 $color__link;

&:hover {
box-shadow: inset 0 -2px 0 $color__link;
}
Expand All @@ -66,10 +67,11 @@ p,

// we don’t include Font Awesome
.searchform .searchsubmit {

span {
display: inherit;
}

.fa {
display: none;
}
Expand Down
4 changes: 3 additions & 1 deletion assets/scss/layout/_posts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
}

#page {

.alignright,
.alignleft {

img {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 100%;
width: auto;

@media (min-width: 601px) {
display: inline;
}
Expand Down
26 changes: 15 additions & 11 deletions assets/scss/navigation/_navigation.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
@use "sass:color";

.main-navigation {
font-size: $size__font-copy;

a {
color: $color__header-link;
font-family: $font__family-headline;
font-weight: 400;

&:hover {
color: $color__header-link-active;
}
}

ul li {

a {
line-height: $size__header;
margin-bottom: 0;
}

&.mlp-language-nav-item {
padding: 0 5px 0 15px;
}

&.mlp-language-current a {
border-bottom: 1px solid #fff;
line-height: 20px;
Expand All @@ -33,25 +36,26 @@ li.mlp-language-nav-item + li.mlp-language-nav-item {
}

.mobile-navigation {
background-color: darken($color__header-background, 10);
background-color: color.adjust($color__header-background, $lightness: -10%);
}

.drawer-wrap .searchform {

.search-input {
background-color: darken($color__header-background, 10);
background-color: color.adjust($color__header-background, $lightness: -10%);
color: $color__header-link;

&:active,
&:focus,
&:hover {
box-shadow: inset 0 0 4px darken($color__header-background, 20);
box-shadow: inset 0 0 4px color.adjust($color__header-background, $lightness: -20%);
color: $color__header-link;
}
}

.searchsubmit {
color: $color__header-link;

&:active,
&:focus,
&:hover {
Expand Down
8 changes: 4 additions & 4 deletions assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use it to make something cool, have fun, and share what you've learned with othe
*/

@import "layout/font-face";
@import 'variables/variables';
@import 'layout/layout';
@import 'elements/elements';
@import 'navigation/navigation';
@import "variables/variables";
@import "layout/layout";
@import "elements/elements";
@import "navigation/navigation";
Loading