liquid_feedback_frontend

annotate app/main/style/style.css.lua @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents
children 85ca5a7e46ec
rev   line source
bsw/jbe@1309 1 slot.set_layout(nil, "text/css")
bsw/jbe@1309 2
bsw/jbe@1309 3 local style = execute.chunk{ module = "style", chunk = "_style", params = { style = config.style } }
bsw/jbe@1309 4
bsw/jbe@1309 5 local scss = [[
bsw/jbe@1309 6 @import "../style/mdl/color-definitions";
bsw/jbe@1309 7 $color-primary: ]] .. style.color.primary .. [[;
bsw/jbe@1309 8 $color-primary-dark: ]] .. style.color.primary .. [[;
bsw/jbe@1309 9 $color-primary-contrast: ]] .. style.color.primary_contrast .. [[;
bsw/jbe@1309 10 $color-accent: ]] .. style.color.accent .. [[;
bsw/jbe@1309 11 $color-accent-contrast: ]] .. style.color.accent_contrast .. [[;
bsw/jbe@1309 12 $checkbox-image-path: "]] .. request.get_absolute_baseurl() .. "static/mdl" .. [[";
bsw/jbe@1309 13 @import "../style/mdl/material-design-lite"
bsw/jbe@1309 14 ]]
bsw/jbe@1309 15
bsw/jbe@1309 16 local key = extos.crypt(json.export(style.color), "$1$12345678") -- TODO hash function
bsw/jbe@1309 17 local filename_scss = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "style-" .. key .. ".scss")
bsw/jbe@1309 18 local filename_css = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "style-" .. key .. ".css")
bsw/jbe@1309 19
bsw/jbe@1309 20 local css_file = io.open(filename_css, "r")
bsw/jbe@1309 21
bsw/jbe@1309 22 if not config.css then
bsw/jbe@1309 23 config.css = {}
bsw/jbe@1309 24 end
bsw/jbe@1309 25
bsw/jbe@1309 26 if not config.css[key] then
bsw/jbe@1309 27 if css_file then
bsw/jbe@1309 28 config.css[key] = css_file:read("*a")
bsw/jbe@1309 29 else
bsw/jbe@1309 30 local scss_file = assert(io.open(filename_scss, "w"))
bsw/jbe@1309 31 scss_file:write(scss)
bsw/jbe@1309 32 scss_file:write("\n")
bsw/jbe@1309 33 scss_file:close()
bsw/jbe@1309 34
bsw/jbe@1309 35 local output, err, status = extos.pfilter(nil, "sassc", filename_scss)
bsw/jbe@1309 36 if status ~= 0 then
bsw/jbe@1309 37 error(err)
bsw/jbe@1309 38 end
bsw/jbe@1309 39 config.css[key] = output
bsw/jbe@1309 40 local css_file = assert(io.open(filename_css, "w"))
bsw/jbe@1309 41 css_file:write(config.css[key])
bsw/jbe@1309 42 css_file:close()
bsw/jbe@1309 43 end
bsw/jbe@1309 44 end
bsw/jbe@1309 45
bsw/jbe@1309 46 slot.put_into("data", config.css[key])
bsw/jbe@1309 47

Impressum / About Us