Jump to content


Photo

Branding/Css.css not loading last

css

  • Please log in to reply
4 replies to this topic

#1 jfgilliam OFFLINE  

jfgilliam

    Advanced Member

  • Members
  • 219 posts
  • Local time: 03:28 AM

Posted 21 September 2018 - 04:42 PM

I'm having a bit of trouble overriding some of your css due to the fact it's loading the branding/css.css before yours. Would it be possible to load it last? I have had success putting that kind of feature at the end of the <body> instead of in the <head>



#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 127006 posts
  • Local time: 03:28 AM

Posted 21 September 2018 - 04:46 PM

It will never be guaranteed to load last. Everything in the web app is modular in nature. Components do not get loaded until they are needed. Because of this, it's impossible to guarantee that your custom css will be loaded last. You'll have to work around this as best you can. Thanks.



#3 DingoPD OFFLINE  

DingoPD

    Member

  • Members
  • 11 posts
  • Local time: 03:28 AM

Posted 24 September 2018 - 01:04 PM

@jfgilliam:

 

i use Nginx proxy to move Emby server from unprivileged port to port 80 and dedicated host name, to simplify access without messing with process privileges on Linux. Since that puts  Nginx in the middle between web client and the server, i was able to inject the CSS link right before body ends. I'm not sure how much help it will be for you, since you seem to run Emby on windows, it might give you an idea, or it could help someone else.

 

Nginx site config snippet:

  location / {

    proxy_pass  http://127.0.0.1:2080;
    proxy_redirect    off;
    proxy_buffering   off;
    proxy_set_header  Host            $host;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header  X-Real-IP       $remote_addr;
    proxy_pass_header Set-Cookie;

    # required to make sub_filter work
    proxy_set_header Accept-Encoding "";

    # compress text files before sending them out
    gzip on;
    gzip_proxied any;
    gzip_types
        text/css
        text/javascript
        text/xml
        text/plain
        application/javascript
        application/x-javascript
        application/json;

    # inject stylesheet right before the end of body
    sub_filter </body>
        '<link rel="stylesheet" type="text/css" href="/Branding/Css.css?v=3.6.0.46">\n</body>';
  }

This also seem to fix the problem with CSS doing strange things right after saving custom styles in dashboard. I used to have to click on profile (top right) and back on dashboard to make it right, reloading would not help.

 

PS: I don't think this will work if you use SSL certificate in Emby to encrypt traffic. I guess you could always use SSL to connect to Nginx and unencrypted connection between Emby and Nginx :)


Edited by DingoPD, 24 September 2018 - 01:09 PM.


#4 pir8radio OFFLINE  

pir8radio

    Advanced Member

  • Members
  • 2694 posts
  • Local time: 02:28 AM

Posted 25 September 2018 - 05:44 PM

@jfgilliam:

 

i use Nginx proxy to move Emby server from unprivileged port to port 80 and dedicated host name, to simplify access without messing with process privileges on Linux. Since that puts  Nginx in the middle between web client and the server, i was able to inject the CSS link right before body ends. I'm not sure how much help it will be for you, since you seem to run Emby on windows, it might give you an idea, or it could help someone else.

 

Nginx site config snippet:

  location / {

    proxy_pass  http://127.0.0.1:2080;
    proxy_redirect    off;
    proxy_buffering   off;
    proxy_set_header  Host            $host;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header  X-Real-IP       $remote_addr;
    proxy_pass_header Set-Cookie;

    # required to make sub_filter work
    proxy_set_header Accept-Encoding "";

    # compress text files before sending them out
    gzip on;
    gzip_proxied any;
    gzip_types
        text/css
        text/javascript
        text/xml
        text/plain
        application/javascript
        application/x-javascript
        application/json;

    # inject stylesheet right before the end of body
    sub_filter </body>
        '<link rel="stylesheet" type="text/css" href="/Branding/Css.css?v=3.6.0.46">\n</body>';
  }

This also seem to fix the problem with CSS doing strange things right after saving custom styles in dashboard. I used to have to click on profile (top right) and back on dashboard to make it right, reloading would not help.

 

PS: I don't think this will work if you use SSL certificate in Emby to encrypt traffic. I guess you could always use SSL to connect to Nginx and unencrypted connection between Emby and Nginx :)

 

 

and the sub_filter module does not come in all nginx builds you have to download a version with it compiled in.   



#5 DingoPD OFFLINE  

DingoPD

    Member

  • Members
  • 11 posts
  • Local time: 03:28 AM

Posted 25 September 2018 - 05:52 PM

and the sub_filter module does not come in all nginx builds you have to download a version with it compiled in.   

 

Ahh, it didn't even occur to me that could be the case, Debian has it baked in by default, sorry about that.







Also tagged with one or more of these keywords: css

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users