Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External prod stylesheet #1161

Merged
merged 3 commits into from
May 28, 2020
Merged

Conversation

huwshimi
Copy link
Contributor

@huwshimi huwshimi commented May 27, 2020

Done

  • Load the UI styles from a stylesheet in production.

QA

  • In a local MAAS run the following:
git config --file=.gitmodules submodule.src/maasui/src.url https://github.com/huwshimi/maas-ui.git
git config --file=.gitmodules submodule.src/maasui/src.branch external-ui-css
git submodule sync
git submodule update --init --recursive --remote
make clean-ui
make ui

You may have to use SKIP_PREFLIGHT_CHECK=true make ui like I did.

Fixes

Fixes: #1157.

package.json Outdated
@@ -12,7 +12,7 @@
"build-ui": "cd ui && yarn install && yarn build",
"cypress-open": "cd proxy && yarn cypress-open",
"cypress-run": "cd proxy && yarn cypress-run",
"copy-build": "mkdir -p build && cp -R root/dist/* build/ && cp -R legacy/dist/assets build/",
"copy-build": "mkdir -p build && cp -R root/dist/* build/ && cp -R legacy/dist/assets build/ && cp ui/dist/static/css/*.css.map build/assets/css/ui.css.map && cp ui/dist/static/css/*.css build/assets/css/ui.css",
Copy link
Contributor

@squidsoup squidsoup May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like potentially undefined behaviour, which file is actually copied? It would be better to just use fixed names here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this to be to use the module name here e.g. ...css/main.*.css. Is that better?

@@ -1,61 +1,4 @@
const webpack = require("webpack");
const path = require("path");
const { edit, remove, getPaths } = require("@rescripts/utilities");
Copy link
Contributor

@squidsoup squidsoup May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @rescripts/utilities dependency can be dropped, although you may find it useful if we need to reconfigure mini-css-extract-plugin.

Copy link
Contributor

@squidsoup squidsoup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Production build includes the css in the js file
2 participants