Jump to content

Branding/Css.css not loading last


jfgilliam

Recommended Posts

jfgilliam

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

pir8radio

@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.   

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...