compile stylesheets separately

This commit is contained in:
byte[] 2019-11-15 19:59:28 -05:00
parent 13168e81cb
commit ca15e74c4a
3 changed files with 24 additions and 3 deletions

View file

@ -1,7 +1,19 @@
module.exports = {
files: {
javascripts: {joinTo: 'js/app.js'},
stylesheets: {joinTo: 'css/app.css'}
stylesheets: {
joinTo: {
'css/default.css': [
'css/themes/default.scss'
],
'css/dark.css': [
'css/themes/dark.scss'
],
'css/red.css': [
'css/themes/red.scss'
]
}
}
},
plugins: {
rollup: {
@ -28,7 +40,7 @@ module.exports = {
assets: /static\//
},
paths: {
watched: ['css/themes/default.scss', 'js/app.js', 'vendor', 'fonts', 'static'],
watched: ['css/themes/default.scss', 'css/themes/dark.scss', 'css/themes/red.scss', 'js/app.js', 'vendor', 'fonts', 'static'],
public: '../priv/static'
},
modules: {

View file

@ -10,7 +10,7 @@ html lang="en"
' - Philomena
- else
' Philomena
link rel="stylesheet" href=Routes.static_path(@conn, "/css/app.css")
link rel="stylesheet" href=stylesheet_path(@conn, @current_user)
link rel="icon" href="/favicon.ico" type="image/x-icon"
link rel="icon" href="/favicon.svg" type="image/svg+xml"
meta name="generator" content="philomena"

View file

@ -42,4 +42,13 @@ defmodule PhilomenaWeb.LayoutView do
tag(:div, class: "js-datastore", data: data)
end
def stylesheet_path(conn, %{theme: "dark"}),
do: Routes.static_path(conn, "/css/dark.css")
def stylesheet_path(conn, %{theme: "red"}),
do: Routes.static_path(conn, "/css/red.css")
def stylesheet_path(conn, _user),
do: Routes.static_path(conn, "/css/default.css")
end