Skip to content
Permalink
Browse files

Refactoring commands

  • Loading branch information...
Depado committed Aug 30, 2019
1 parent de5c61d commit bee2386efc4f3c3108ae62dbfb9de97d3027a402
Showing with 347 additions and 246 deletions.
  1. +9 −6 Makefile
  2. +25 −10 {css → assets/sass}/_admonition.scss
  3. 0 {css → assets/sass}/style.scss
  4. +1 −1 assets/style.min.css
  5. +1 −1 assets/style.min.css.map
  6. +55 −61 cmd/generate.go
  7. +79 −61 cmd/new.go
  8. +51 −47 cmd/root.go
  9. +17 −25 cmd/serve.go
  10. +0 −15 cmd/validate.go
  11. +9 −5 go.mod
  12. +24 −12 go.sum
  13. +75 −1 main.go
  14. +1 −1 models/file.go
@@ -3,22 +3,25 @@
export GO111MODULE=on
export CGO_ENABLED=false
BINARY=smallblog
VERSION=$(shell git describe --abbrev=0 --tags 2> /dev/null || echo "0.1.0")
BUILD=$(shell git rev-parse HEAD 2> /dev/null || echo "undefined")
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.Build=$(BUILD)"

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: build
build: ## Build
go build -o $(BINARY)

.PHONY: css
css: ## Build the CSS and map file from scss
sass css/style.scss:assets/style.min.css --style compressed
go build -o $(BINARY) $(LDFLAGS)

.PHONY: install
install: ## Build and install
go install
go install $(LDFLAGS)

.PHONY: css
css: ## Build the CSS and map file from scss
sass assets/sass/style.scss:assets/style.min.css --style compressed

.PHONY: run
run: ## Runs the server
@@ -1,7 +1,8 @@
$colors: (
"success": #64dd17,
"question": #00c853,
"info": #448aff,
"note": #448aff,
"info": #00b8d4,
"warning": #ff9100,
"hint": #009688,
"danger": #ff1744
@@ -13,14 +14,16 @@ $icons: (
"question": "\f128",
"hint": "\f06d",
"success": "\f00c",
"warning": "\f071"
"warning": "\f071",
"important": "\f12a"
);

@mixin admonition($color, $icon) {
$dark: rgba($color, 0.1);
border-left: 0.2rem solid $color;
> p.admonition-title {
background-color: $dark;
font-size: 0.75rem;
&::before {
font-family: "Font Awesome 5 Free";
font-weight: 900;
@@ -32,12 +35,13 @@ $icons: (
}

.admonition {
$color: map-get($colors, "info");
// Default color when admonition is used without type
$color: map-get($colors, "note");
$dark: rgba($color, 0.1);
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12),
0 3px 1px -2px rgba(0, 0, 0, 0.2);
position: relative;
margin: 1.5625em 0;
margin: 1.5em 0;
padding: 0 0.6rem;
border-left: 0.2rem solid $color;
border-left-color: $color;
@@ -53,20 +57,20 @@ $icons: (
font-weight: 700;
}

&.note,
&.note {
@include admonition(map-get($colors, "note"), map-get($icons, "note"));
}
&.info {
@include admonition(map-get($colors, "info"), map-get($icons, "note"));
}
&.danger {
@include admonition(map-get($colors, "danger"), map-get($icons, "danger"));
}
&.question {
@include admonition(
map-get($colors, "question"),
map-get($icons, "question")
);
}
&.hint {
&.hint,
&.tip {
@include admonition(map-get($colors, "hint"), map-get($icons, "hint"));
}
&.success {
@@ -75,10 +79,21 @@ $icons: (
map-get($icons, "success")
);
}
&.warning {
&.warning,
&.caution {
@include admonition(
map-get($colors, "warning"),
map-get($icons, "warning")
);
}
&.danger,
&.error {
@include admonition(map-get($colors, "danger"), map-get($icons, "danger"));
}
&.important {
@include admonition(
map-get($colors, "danger"),
map-get($icons, "important")
);
}
}
File renamed without changes.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit bee2386

Please sign in to comment.
You can’t perform that action at this time.