Skip to content

Commit

Permalink
Merge pull request #97 from spacenomads/issue/95-sass-dart
Browse files Browse the repository at this point in the history
Issue/95-sass-dart
  • Loading branch information
oneeyedman authored Oct 12, 2023
2 parents 94edb29 + 9089558 commit f8243a9
Show file tree
Hide file tree
Showing 13 changed files with 1,961 additions and 9,640 deletions.
5 changes: 3 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"color-hex-case": "lower",
"color-hex-length": "short",
"color-no-invalid-hex": true,
"comment-no-empty": true,
"comment-no-empty": null,
"comment-whitespace-inside": "always",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": true,
Expand Down Expand Up @@ -67,6 +67,7 @@
"unit-no-unknown": true,
"value-keyword-case": "lower",
"scss/at-extend-no-missing-placeholder": true,
"scss/at-rule-no-unknown": true
"scss/at-rule-no-unknown": true,
"scss/comment-no-empty": null
}
}
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/spacenomads/Asteroids/main?label=Version&labelColor=414141&color=ffcc00)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?labelColor=%23414141&color=%23ffcc00)](code_of_conduct.md)


Ahoy! This kit is my all-new/all-old web starter kit. Use it well!

<center>
<img src="asteroids-700.png" width="350">
<img src="asteroids-700.png" width="350" alt="">
</center>

With the help of [Gulp](https://gulpjs.com) and [11ty](https://www.11ty.dev/), Asteroids includes SCSS processing, JS minification and [Nunjucks](https://mozilla.github.io/nunjucks/), a super cool template engine created by Mozilla.
Expand Down Expand Up @@ -161,4 +160,3 @@ So, what is next?
## Request a feature

Do you miss anything? Feel free to [request a feature](https://github.com/spacenomads/Asteroids/issues/new?assignees=oneeyedman&labels=%F0%9F%92%A1+New%21&template=---feature-request.md&title=) or contribute to making it better ;)

9 changes: 5 additions & 4 deletions _src/_data/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ function getStaticsVersion() {


module.exports = {
'lang': 'en',
'mode': process.env.MODE,
'version': getStaticsVersion(),
'year': getYear(),
lang: 'en',
mode: process.env.MODE,
siteName: 'Asteroids',
version: getStaticsVersion(),
year: getYear(),
};
39 changes: 20 additions & 19 deletions _src/_templates/layouts/main.njk
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<!DOCTYPE html>
<html lang="{{ settings.lang }}">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#212121" media="(prefers-color-scheme: dark)">
<title>{{ settings.siteName }}</title>
<script src="assets/js/app.js" type="module" defer></script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#212121" media="(prefers-color-scheme: dark)">
<title>{{ settings.siteName }}</title>
<link rel="stylesheet" href="assets/css/main.css">
<script src="assets/js/app.js" type="module" defer></script>
</head>
<body>
<div class="page">
<header class="page__header header">
<div class="wrapper">
<a href="/" class="header__brand">
<div class="brand">Asteroids</div>
</a>
</div>
<div class="page">
<header class="page__header header">
<div class="wrapper">
<a href="/" class="header__brand">
<div class="brand">Asteroids</div>
</a>
</div>

{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({
listElement: 'ul',
Expand All @@ -26,12 +27,12 @@
anchorClass: 'menu__link'
}) | safe }}
</header>
<main class="page__main main">
{{ content | safe }}
</main>
<footer class="page__footer">
<main class="page__main main">
{{ content | safe }}
</main>
<footer class="page__footer">
{{ settings.year }}
</footer>
</div>
</div>
</body>
</html>
18 changes: 18 additions & 0 deletions _src/assets/_scss/_sample-page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@use 'core/core';

body {
background-color: core.$color-bg;
color: core.$color-correct-blue;
font-size: core.rem(20);

@include core.mq(600) {
color: black;
}
}

@include core.mq(600) {
p {
border: 1px solid orange;
color: blue;
}
}
3 changes: 3 additions & 0 deletions _src/assets/_scss/core/_core.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@forward 'vars';
@forward 'functions';
@forward 'mixins';
73 changes: 73 additions & 0 deletions _src/assets/_scss/core/_functions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@use 'vars';

// ***
// Stylesheet _functions.scss
//
// Table of Contents:
// 1. em()
// 2. rem()
// 3. px()
// 4. per()
// 5. img()
// 6. lh()
//
// ***





// 1. em()
// ---
@function em( $pixels, $context: vars.$font-size ) {
@return calc($pixels / $context * 1em);
}




// 2. rem()
// ---
@function rem( $pixels ) {
$context: vars.$font-size;
@return calc($pixels / $context * 1rem);
}




// 3. px()
// ---
@function px( $pixels ) {
@return calc($pixels * 1px);
}





// 4. per()
// ---
@function per( $pixels, $context: vars.$page-max-width ) {
@return ( $pixels * 100% / $context );
}





// 5. img()
// ---
@function img( $image, $path: vars.$theme ) {
@return url( $path + $image );
}





// 6. lh()
// ---
@function lh( $fline, $fsize: vars.$font-size ) {
@return calc($fline * 100% / $fsize);
}
51 changes: 51 additions & 0 deletions _src/assets/_scss/core/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@use 'vars';
@use 'functions' as fn;

// ***
// Stylesheet _mixins.scss
//
// Table of Contents:
// 1. z()
// 2. mq()
// 3. screen-reader-only()
//
// ***





// 1. z()
// ---
@mixin z($level, $list: vars.$levels) {
z-index: index($list, $level);
}





// 2. mq()
// ---
@mixin mq($pixels, $width: min-width) {
@media screen and ($width: fn.em($pixels)) {
@content;
}
}





// 3. screen-reader-only()
// ---
@mixin screen-reader-only() {
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
51 changes: 51 additions & 0 deletions _src/assets/_scss/core/_vars.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// ***
// Stylesheet _vars.scss
//
// Table of Contents:
// 1. Colors
// 2. Fonts
// 3. Dimensions
// 4. Levels
// 5. Themes
//
// ***





// 1. Colors
// ---
$color-correct-blue: #007aff;
$color-bg: #f4f5f6;





// 2. Fonts
// ---
$font-size: 16;





// 3. Dimensions
// ---
$page-max-width: 1280;




// 4. Levels
// ---
$levels: footer, content, header;





// 5. Themes
// ---
$theme: 'layout/'
17 changes: 1 addition & 16 deletions _src/assets/_scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
$color-correct-blue: #007aff;

body {
color: $color-correct-blue;

@media screen and (min-width: 600px) {
color: black;
}
}

@media screen and (min-width: 600px) {
p {
border: 1px solid orange;
color: blue;
}
}
@use 'sample-page';
4 changes: 3 additions & 1 deletion _src/assets/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f8243a9

Please sign in to comment.