Updates on assets

pull/144/head
Henrique Dias 2017-06-25 22:39:18 +01:00
parent 58946e691e
commit cca2d9c4c6
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
3 changed files with 25 additions and 30 deletions

View File

@ -1,20 +1,18 @@
/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Correct the line height in all browsers.
* 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
html {
font-family: sans-serif; /* 1 */
line-height: 1.15; /* 2 */
-ms-text-size-adjust: 100%; /* 3 */
-webkit-text-size-adjust: 100%; /* 3 */
line-height: 1.15; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
@ -108,17 +106,7 @@ a {
}
/**
* Remove the outline on focused links when they are also active or hovered
* in all browsers (opinionated).
*/
a:active,
a:hover {
outline-width: 0;
}
/**
* 1. Remove the bottom border in Firefox 39-.
* 1. Remove the bottom border in Chrome 57- and Firefox 39-.
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
@ -317,13 +305,11 @@ button:-moz-focusring,
}
/**
* Change the border, margin, and padding in all browsers (opinionated).
* Correct the padding in Firefox.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
padding: 0.35em 0.75em 0.625em;
}
/**
@ -458,4 +444,4 @@ template {
[hidden] {
display: none;
}
}

View File

@ -81,6 +81,7 @@ type User struct {
type assets struct {
requiredJS *rice.Box // JS that is always required to have in order to be usable.
baseTemplates *rice.Box
baseCSS *rice.Box
Templates *rice.Box
CSS *rice.Box
JS *rice.Box
@ -117,7 +118,7 @@ func New(scope string) *FileManager {
AfterSave: func(r *http.Request, m *FileManager, u *User) error { return nil },
Assets: &assets{
baseTemplates: rice.MustFindBox("./_assets/templates"),
CSS: rice.MustFindBox("./_assets/css"),
baseCSS: rice.MustFindBox("./_assets/css"),
requiredJS: rice.MustFindBox("./_assets/js"),
},
}

View File

@ -22,7 +22,15 @@ func serveAssets(w http.ResponseWriter, r *http.Request, m *FileManager) (int, e
switch {
case strings.HasPrefix(filename, "/css"):
filename = strings.Replace(filename, "/css/", "", 1)
file, err = m.Assets.CSS.Bytes(filename)
if m.Assets.CSS != nil {
file, err = m.Assets.JS.Bytes(filename)
if err == nil {
break
}
}
file, err = m.Assets.baseCSS.Bytes(filename)
case strings.HasPrefix(filename, "/js"):
filename = strings.Replace(filename, "/js/", "", 1)
file, err = m.Assets.requiredJS.Bytes(filename)