Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何为不同的客户端创建多个主题(css)_Javascript_Css_Angular_Sass_Themes - Fatal编程技术网

Javascript 如何为不同的客户端创建多个主题(css)

Javascript 如何为不同的客户端创建多个主题(css),javascript,css,angular,sass,themes,Javascript,Css,Angular,Sass,Themes,我需要允许每个客户定制自己的主题。 我的问题是如何在有人登录之前知道显示哪个主题 我的想法是为每个客户端使用一个子域 任何人都可以为我提供一份关于如何实现这一点的最佳实践指南? 我在客户端使用Angular 4 谢谢。1)糟糕的解决方案(更改为css) 2) 好办法 constructor (@Inject(DOCUMENT) private document) { } FirstTheme() { this.document.getElementBy

我需要允许每个客户定制自己的主题。 我的问题是如何在有人登录之前知道显示哪个主题

我的想法是为每个客户端使用一个子域

任何人都可以为我提供一份关于如何实现这一点的最佳实践指南? 我在客户端使用Angular 4

谢谢。

1)糟糕的解决方案(更改为css)

2) 好办法

 constructor (@Inject(DOCUMENT) private document) { }

        FirstTheme() {
            this.document.getElementById('theme').setAttribute('href', 'first-theme.css'); }


        SecondTheme() {
            this.document.getElementById('theme').setAttribute('href', 'second-theme.css'); }

如果你想使用子域,你需要购买一个更昂贵的ssl证书,此外,它们并不都卖。我希望您正在使用https?目前我正在使用http,但将来将使用https。我不介意为ssl证书多花一点钱,问题是实现这一点的最佳实践是什么?使用子域是正确的方法吗?我不这么认为。取决于主题中界面的深度处理。尝试只做csss,直到在用户登录之前知道要加载哪个css?我没有看到任何其他解决方案,然后子域。为什么css的主题加载之前登录?毕竟,您不知道这是同一个用户。
 constructor (@Inject(DOCUMENT) private document) { }

        FirstTheme() {
            this.document.getElementById('theme').setAttribute('href', 'first-theme.css'); }


        SecondTheme() {
            this.document.getElementById('theme').setAttribute('href', 'second-theme.css'); }