just one /style.css

use 'go generate -tags dev' to produce the dev build and 'go generate'
for the prod build. have them produce the same file.

The only problem is that one needs to run this in web/styles first
before updating assets.
This commit is contained in:
Henry 2021-02-11 18:37:51 +01:00
parent 8401472b8f
commit 9019ebd130
8 changed files with 39 additions and 60 deletions

3
web/assets/style.css Normal file
View File

@ -0,0 +1,3 @@
/*! tailwindcss v2.0.3 | MIT License | https://tailwindcss.com*/
/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=submit],button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}html{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{font-family:inherit;line-height:inherit}*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder, textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder, textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.block{display:block}.table{display:table}.mx-auto{margin-left:auto;margin-right:auto}*{--tw-shadow:0 0 transparent;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,0.5);--tw-ring-offset-shadow:0 0 transparent;--tw-ring-shadow:0 0 transparent}@-webkit-keyframes spin{to{transform:rotate(1turn)}}@keyframes spin{to{transform:rotate(1turn)}}@-webkit-keyframes ping{75%,to{transform:scale(2);opacity:0}}@keyframes ping{75%,to{transform:scale(2);opacity:0}}@-webkit-keyframes pulse{50%{opacity:.5}}@keyframes pulse{50%{opacity:.5}}@-webkit-keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}

File diff suppressed because one or more lines are too long

6
web/styles/gen_dev.go Normal file
View File

@ -0,0 +1,6 @@
// +build dev
package styles
//go:generate npm ci
//go:generate npm run compile-dev

View File

@ -1,5 +1,6 @@
// +build !dev
package styles
//go:generate npm ci
//go:generate npm run compile-dev
//go:generate npm run compile-prod

View File

@ -2,8 +2,8 @@
"name": "css-go-ssb-room",
"version": "1.0.0",
"scripts": {
"compile-dev": "postcss input.css -o ../assets/styles/compiled.dev.css",
"compile-prod": "NODE_ENV=production postcss input.css -o ../assets/styles/compiled.prod.css"
"compile-dev": "postcss input.css -o ../assets/style.css",
"compile-prod": "NODE_ENV=production postcss input.css -o ../assets/style.css"
},
"engines": {
"node": ">=12"

View File

@ -4,11 +4,7 @@
<!-- complete base template -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{if is_production}}
<link href="/assets/styles/compiled.prod.css" rel="stylesheet">
{{else}}
<link href="/assets/styles/compiled.dev.css" rel="stylesheet">
{{end}}
<link href="/assets/style.css" rel="stylesheet">
<title>{{block "title" .}}Go-SSB Room Server{{end}}</title>
</head>
<body>

File diff suppressed because one or more lines are too long

View File

@ -24,9 +24,8 @@ import (
func TemplateFuncs(m *mux.Router) template.FuncMap {
return template.FuncMap{
"urlTo": NewURLTo(m),
"inc": func(i int) int { return i + 1 },
"is_production": func() bool { return Production },
"urlTo": NewURLTo(m),
"inc": func(i int) int { return i + 1 },
}
}