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

Replace remote styles and fonts with the ones served locally #826

Merged
merged 3 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,5 @@
<!-- asyncronously load the (entry) react bundle -->
<script async src="/dist/auspice.bundle.js"></script>

<!-- by placing this in the body, we mimic async ability
This is important as sometimes unpkg takes 10s to return and, if in the header
this blocks the page load.
https://codepen.io/tigt/post/async-css-without-javascript
https://stackoverflow.com/questions/9271276/is-the-recommendation-to-include-css-before-javascript-invalid
-->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Lato:100,200,300,400,500,700">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />

</body>
</html>
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"express-naked-redirect": "^0.1.2",
"express-static-gzip": "^0.2.2",
"file-loader": "^1.1.11",
"font-awesome": "^4.7.0",
"json-loader": "^0.5.1",
"leaflet": "^1.2.0",
"leaflet-image": "^0.4.0",
Expand Down Expand Up @@ -101,6 +102,7 @@
"run-sequence": "~0.3.6",
"style-loader": "^0.13.2",
"styled-components": "^4.0.3",
"typeface-lato": "^0.0.75",
"webpack": "^4.30.0",
"webpack-cli": "^3.1.2",
"webpack-dev-middleware": "^3.1.3",
Expand Down
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Provider } from "react-redux";
import configureStore from "./store";
import { initialiseGoogleAnalyticsIfRequired } from "./util/googleAnalytics";
/* S T Y L E S H E E T S */
import "font-awesome/css/font-awesome.css";
import "leaflet/dist/leaflet.css";
import "./css/global.css";
import "./css/browserCompatability.css";
import "./css/bootstrapCustomized.css";
Expand All @@ -18,6 +20,9 @@ import "./css/notifications.css";
import "./css/boxed.css";
import "./css/select.css";

/* FONTS */
import 'typeface-lato';

const store = configureStore();

/* set up non-redux state storage for the animation - use this conservitavely! */
Expand Down
9 changes: 7 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ const generateConfig = ({extensionPath, devMode=false, customOutputPath, analyze
use: ["style-loader", "css-loader"]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
test: /\.(gif|png|jpe?g|svg|woff2?|eot|otf|ttf)$/i,
use: "file-loader",
include: directoriesToTransform
include: [
...directoriesToTransform,
path.join(__dirname, 'node_modules/font-awesome'),
path.join(__dirname, 'node_modules/leaflet'),
path.join(__dirname, 'node_modules/typeface-lato')
]
}
]
}
Expand Down