liquid_feedback_frontend

diff 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
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/style/style.css.lua	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -0,0 +1,47 @@
     1.4 +slot.set_layout(nil, "text/css")
     1.5 +
     1.6 +local style = execute.chunk{ module = "style", chunk = "_style", params = { style = config.style } }
     1.7 +
     1.8 +local scss = [[
     1.9 +@import "../style/mdl/color-definitions";
    1.10 +$color-primary: ]] .. style.color.primary .. [[;
    1.11 +$color-primary-dark: ]] .. style.color.primary .. [[;
    1.12 +$color-primary-contrast: ]] .. style.color.primary_contrast .. [[;
    1.13 +$color-accent: ]] .. style.color.accent .. [[;
    1.14 +$color-accent-contrast: ]] .. style.color.accent_contrast .. [[;
    1.15 +$checkbox-image-path: "]] .. request.get_absolute_baseurl() .. "static/mdl" .. [[";
    1.16 +@import "../style/mdl/material-design-lite"
    1.17 +]]
    1.18 +
    1.19 +local key = extos.crypt(json.export(style.color), "$1$12345678") -- TODO hash function
    1.20 +local filename_scss = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "style-" .. key .. ".scss")
    1.21 +local filename_css = encode.file_path(WEBMCP_BASE_PATH, 'tmp', "style-" .. key .. ".css")
    1.22 +
    1.23 +local css_file = io.open(filename_css, "r")
    1.24 +
    1.25 +if not config.css then
    1.26 +  config.css = {}
    1.27 +end
    1.28 +
    1.29 +if not config.css[key] then
    1.30 +  if css_file then
    1.31 +    config.css[key] = css_file:read("*a")
    1.32 +  else
    1.33 +    local scss_file = assert(io.open(filename_scss, "w"))
    1.34 +    scss_file:write(scss)
    1.35 +    scss_file:write("\n")
    1.36 +    scss_file:close()
    1.37 +
    1.38 +    local output, err, status = extos.pfilter(nil, "sassc", filename_scss)
    1.39 +    if status ~= 0 then
    1.40 +      error(err)
    1.41 +    end
    1.42 +    config.css[key] = output
    1.43 +    local css_file = assert(io.open(filename_css, "w"))
    1.44 +    css_file:write(config.css[key])
    1.45 +    css_file:close()
    1.46 +  end
    1.47 +end
    1.48 +
    1.49 +slot.put_into("data", config.css[key])
    1.50 +

Impressum / About Us