Better handling of template generation
This commit is contained in:
parent
11eca44374
commit
32b5dbb8cb
2 changed files with 65 additions and 47 deletions
32
Makefile
32
Makefile
|
@ -1,13 +1,23 @@
|
||||||
|
|
||||||
GOFILES=$(wildcard *.go)
|
GOFILES=$(wildcard *.go)
|
||||||
NAME=musala-push
|
NAME=musala-push
|
||||||
|
MJML_TEMPLATES=$(wildcard templates/*.mjml)
|
||||||
|
MJML_OUTPUT=$(patsubst %.mjml,%.mjml.html,$(MJML_TEMPLATES))
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
.PHONY: build
|
%.mjml.html: %.mjml
|
||||||
build: ## build executable
|
npx mjml $< --config.minify > $@
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: build build-binaries build-templates
|
||||||
|
build: build-binaries build-templates ## build executable
|
||||||
|
|
||||||
|
build-binaries: build-templates
|
||||||
go build ./...
|
go build ./...
|
||||||
|
|
||||||
|
build-templates: $(MJML_OUTPUT)
|
||||||
|
|
||||||
install: ## install binaries
|
install: ## install binaries
|
||||||
go install ./...
|
go install ./...
|
||||||
|
|
||||||
|
@ -19,8 +29,13 @@ shellcheck: ## run shellcheck validation
|
||||||
help: ## print this help
|
help: ## print this help
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean clean-templates clean-binaries
|
||||||
clean: ## remove build artifacts
|
clean: clean-templates clean-binaries ## remove build artifacts
|
||||||
|
|
||||||
|
clean-templates:
|
||||||
|
rm -f ./templates/*.mjml.html
|
||||||
|
|
||||||
|
clean-binaries:
|
||||||
rm -rf ./_build/*
|
rm -rf ./_build/*
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
|
@ -30,13 +45,4 @@ npm:
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
|
|
||||||
MJML_TEMPLATES=$(wildcard templates/*.mjml)
|
|
||||||
MJML_OUTPUT=$(patsubst %.mjml,%.mjml.html,$(MJML_TEMPLATES))
|
|
||||||
|
|
||||||
%.mjml.html: %.mjml
|
|
||||||
npx mjml $< --config.minify > $@
|
|
||||||
|
|
||||||
templates: $(MJML_OUTPUT)
|
|
||||||
|
|
||||||
.PHONY: templates
|
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,55 @@
|
||||||
<mjml>
|
<mjml>
|
||||||
|
<mj-head>
|
||||||
|
<mj-style inline="inline">
|
||||||
|
.footer-link { color: white !important; font-weight: bold; text-decoration: underline !important; }
|
||||||
|
</mj-style>
|
||||||
|
</mj-head>
|
||||||
|
|
||||||
<mj-body>
|
<mj-body>
|
||||||
<mj-section>
|
<mj-section>
|
||||||
<mj-group>
|
<mj-group>
|
||||||
<mj-column>
|
<mj-column>
|
||||||
<mj-image width="100px" src="/assets/img/logo-small.png"></mj-image>
|
<mj-image width="100px" src="/assets/img/logo-small.png"></mj-image>
|
||||||
</mj-column>
|
</mj-column>
|
||||||
<mj-column>
|
<mj-column>
|
||||||
<mj-text font-size="20px" color="#F45E43" font-family="helvetica" align="center">
|
<mj-text font-size="20px" color="#F45E43" font-family="helvetica" align="center">
|
||||||
Mardi 28 aout 2020
|
Mardi 28 aout 2020
|
||||||
</mj-text>
|
</mj-text>
|
||||||
<mj-button font-family="Helvetica" background-color="#f45e43" color="white">Visit Board
|
<mj-button href="#" font-family="Helvetica" background-color="#f45e43" color="white">Visit Board
|
||||||
</mj-button>
|
</mj-button>
|
||||||
</mj-column>
|
</mj-column>
|
||||||
</mj-group>
|
</mj-group>
|
||||||
</mj-section>
|
|
||||||
<mj-section>
|
|
||||||
<mj-column>
|
|
||||||
<mj-divider border-color="#F45E43"></mj-divider>
|
|
||||||
<mj-text font-size="20px" color="#F45E43" font-family="helvetica" align="center">
|
|
||||||
Your daily task list for
|
|
||||||
</mj-text>
|
|
||||||
<mj-text font-size="24px" font-weight="bold" color="#F45E43" font-family="helvetica" align="center">
|
|
||||||
BC.Business.Operational
|
|
||||||
</mj-text>
|
|
||||||
<mj-divider border-color="#F45E43"></mj-divider>
|
|
||||||
</mj-column>
|
|
||||||
</mj-section>
|
</mj-section>
|
||||||
<mj-section>
|
<mj-section>
|
||||||
<mj-column>
|
<mj-column>
|
||||||
<mj-text font-size="20px" color="#f45e43" font-family="helvetica" font-weight="bold" align="left" >
|
<mj-divider border-color="#F45E43"></mj-divider>
|
||||||
Topic dsfsdfs
|
<mj-text font-size="20px" color="#F45E43" font-family="helvetica" align="center">
|
||||||
</mj-text>
|
Your daily task list for
|
||||||
<mj-text font-size="16px" color="#666" font-family="helvetica" font-weight="bold" align="left">
|
</mj-text>
|
||||||
Topic dsfsdfs
|
<mj-text font-size="24px" font-weight="bold" color="#F45E43" font-family="helvetica" align="center">
|
||||||
</mj-text>
|
BC.Business.Operational
|
||||||
<mj-text font-size="16px" color="#666" font-family="helvetica" align="left">
|
</mj-text>
|
||||||
Lorem ipsum dolor sit amet, blablablabla <a href="rezrez">truc</a>
|
<mj-divider border-color="#F45E43"></mj-divider>
|
||||||
</mj-text>
|
</mj-column>
|
||||||
</mj-column>
|
</mj-section>
|
||||||
|
<mj-section>
|
||||||
|
<mj-column>
|
||||||
|
<mj-button font-size="20px" font-family="Helvetica" font-weight="bold" background-color="#f45e43" align="left" color="white">Topic ABC
|
||||||
|
</mj-button>
|
||||||
|
<mj-text font-size="16px" color="#666" padding-bottom="0" font-family="helvetica" font-weight="bold" align="left">
|
||||||
|
Topic dsfsdfs
|
||||||
|
</mj-text>
|
||||||
|
<mj-text font-size="16px" color="#666" font-family="helvetica" align="left">
|
||||||
|
Lorem ipsum dolor sit amet, blablablabla <a href="rezrez">>> see more</a>
|
||||||
|
</mj-text>
|
||||||
|
</mj-column>
|
||||||
|
</mj-section>
|
||||||
|
<mj-section>
|
||||||
|
<mj-column background-color="white" inner-background-color="#f45e43" padding-right="20px" padding-left="20px">
|
||||||
|
<mj-text font-size="16px" color="#ffffff" font-family="helvetica" align="left" >
|
||||||
|
To stop receiving these emails, you can change your <a href="#" class="footer-link">notification preferences</a> in <a href="#" class="footer-link">Musala</a>.
|
||||||
|
</mj-text>
|
||||||
|
</mj-column>
|
||||||
</mj-section>
|
</mj-section>
|
||||||
</mj-body>
|
</mj-body>
|
||||||
</mjml>
|
</mjml>
|
||||||
|
|
Loading…
Reference in a new issue