-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: small styles and quality of life improvements (#2058)
* fix / improve vite config file styles source maps in dev are very helpful during development `css.preprocessorOptions.scss.additionalData` needs to be a string or a function, so having array was wrong and did't work with `devSourcemap` setting. modern scss compiler api is just a suggested by sass and legacy api will be sooner or later removed. * improve jekyll-dev config adding `_assets/styles/` directory to excluded allows vite to handle sass files compilation and when developing won't cause jekyll to hard refresh page whenever styles changes and allow vite to hot reload just styles * fix navbar for 404 pages `this.sidebarButton` is null for some pages, like 404 * cleanup and improve prism.js 1. `vite` is minifying scripts and styles during production builds so it was unnecessary to import minified versions. Importing minified versions was causing that it was harded to debug styles/scripts during developement 2. plugin `prism-show-language` was not used, and it was imported before `prism-toolbar` which was causing it was not even working and logging warninng message in console 3. we are not using `prism-tomorrow` theme 4. moving out copy icon html elements and formated it with new lines made it a little bit easier to read * removed unused prism-ghcolors.scss * fix and improve sidebar.js script 1. `expandActiveGroup` was incorrectly closing groups which were nested more than one level - this commit fixes that 2. smoth scrolling to sidebar element was broken when there was not enough scroll height to show the active link in the middle. In such cases it was moving down global page scroll with the missing height value 3. small refactoring of `setActiveLink` method * fix copy to clipboard button in code blocks 1. now instead of being visible on the left side of the string with a type of code (`yaml`, `sh` etc.) when you are hovering over code block it's hiding the type string and showing always in the same position - top right corner. It was broken before for blocks which types were longer than `sh`. 2. added simple fade for the button on hover 3. fixed position of sting "Copied!" when clicked * fixed line numbers in code blocks when code block had more than 9 lines it was broken as line numbers 10+ had not enough padding on the left - not it looks fine for line numbers up to 99 * stick version selector and search bar even when scroll is present Now, even if sidebar is longer than the screen height, version selector and search bar will always be present at the top. This commit also removes this weird unnecessary empty space at the bottom of the sidebar. * improve pages with version alerts 1. version alert block now has the same width to the rest of page 2. huge empty space between version alert and the page header was shrinked so it looks more natural * improve dev related make targets and remove unnecessary files 1. Instead of using raw vite we can use netlify, which we are still using otherwise. It also have result that specified by us redirects in `_common-redirects` and _redirects` files work. 2. Using netlify instead of vite with its scripts under `bin` directory in `Procfile` results in kill signals to properly propagate so `kill-ports` shouldn't be needed 3. I removed unnecessary scripts section from package.json file Signed-off-by: Bart Smykla <[email protected]>
- Loading branch information
1 parent
e6fc286
commit 5917de6
Showing
22 changed files
with
165 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
vite: bin/vite dev | ||
jekyll: bin/jekyll-vite wait && bundle exec jekyll serve --livereload --config jekyll-dev.yml | ||
netlify: npx netlify dev | ||
jekyll: bundle exec jekyll serve --livereload --config jekyll-dev.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
import Prism from 'prismjs' | ||
import 'prismjs/plugins/line-numbers/prism-line-numbers.min.js' | ||
import 'prismjs/components/prism-bash.min.js' | ||
import 'prismjs/components/prism-systemd.min.js' | ||
import 'prismjs/components/prism-yaml.min.js' | ||
import 'prismjs/components/prism-json.min.js' | ||
|
||
import 'prismjs/plugins/show-language/prism-show-language.min.js' | ||
import 'prismjs/plugins/autoloader/prism-autoloader.min.js' | ||
import 'prismjs/plugins/toolbar/prism-toolbar.min.js' | ||
import 'prismjs/plugins/toolbar/prism-toolbar.min.css' | ||
import "prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"; | ||
|
||
import 'prismjs/themes/prism.min.css' | ||
import "prismjs/themes/prism-tomorrow.min.css"; | ||
import 'prismjs/plugins/line-numbers/prism-line-numbers.min.css' | ||
|
||
import 'prismjs/components/prism-bash.js' | ||
import 'prismjs/components/prism-systemd.js' | ||
import 'prismjs/components/prism-yaml.js' | ||
import 'prismjs/components/prism-json.js' | ||
import 'prismjs/plugins/autoloader/prism-autoloader.js' | ||
import 'prismjs/plugins/line-numbers/prism-line-numbers.js' | ||
import 'prismjs/plugins/toolbar/prism-toolbar.js' | ||
import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.js' | ||
// styles | ||
import 'prismjs/themes/prism.css' | ||
import 'prismjs/plugins/line-numbers/prism-line-numbers.css' | ||
import 'prismjs/plugins/toolbar/prism-toolbar.css' | ||
import '@/styles/prismjs/prism-vs.scss' | ||
|
||
Prism.highlightAll(); | ||
|
||
document.addEventListener('DOMContentLoaded', (event) => { | ||
const icon = ` | ||
<span> | ||
<svg data-v-49140617="" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="hover"> | ||
<path data-v-49140617="" fill="none" d="M0 0h24v24H0z"></path> | ||
<path data-v-49140617="" fill="#4e1999" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"></path> | ||
</svg> | ||
</span> | ||
<span>Copied!</span> | ||
`; | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
document.querySelectorAll('.copy-to-clipboard-button').forEach((elem) => { | ||
let icon = '<span><svg data-v-49140617="" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="hover"><path data-v-49140617="" fill="none" d="M0 0h24v24H0z"></path> <path data-v-49140617="" fill="#4e1999" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z"></path></svg></span>'; | ||
elem.innerHTML = icon + '<span>Copied!</span>'; | ||
elem.innerHTML = icon; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.