Coder Social home page Coder Social logo

Comments (3)

simov avatar simov commented on June 15, 2024 1

Here is an example configuration for NginX that I'm using:

location / {
  # your Express Admin server
  proxy_pass http://localhost:3000;
}

# Static Files:

# express-admin
location ~ /express-admin\.(css|js) {
  root /path/to/node_modules/express-admin/public;
  try_files $uri $uri;
}

# custom - in case you have any custom views
location ~ /custom\.(css|js) {
  root /path/to/your/custom/views/static/files;
  try_files $uri $uri;
}

# express-admin-static
root /path/to/node_modules/express-admin-static;
location ^~ /jslib/ {
  try_files $uri $uri;
}
location ^~ /csslib/ {
  try_files $uri $uri;
}
location ^~ /font/ {
  try_files /csslib/fonts/$uri =404;
}
location ^~ /bootswatch/ {
  try_files $uri $uri;
}

from express-admin.

gravyTrainee avatar gravyTrainee commented on June 15, 2024 1

Thanks @simov!

It appears that the script to change bootstrap themes is responsible for this. I'm using this workaround so that the default theme won't trigger the FOUC (views/js/theme.html):

<script type="text/javascript">
    var xAdmin = {root: '{{root}}'};
    (function () {
        var theme = localStorage.getItem('theme') || 'default';
        if (theme == 'default')
            return;
        var bootstrap = document.getElementById('bootstrap');
        bootstrap.href = xAdmin.root+'/bootswatch/'+theme+'/bootstrap.min.css';
    }());
</script>

This only prevents the FOUC for the default theme, but may help someone else. :)

from express-admin.

simov avatar simov commented on June 15, 2024

What I have seen improving this situation is putting Express Admin behind NginX for example. In that setup you let NginX serve all of the static assets and Node.js to serve the Express Admin routes only.

from express-admin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.