Skip to content

Commit

Permalink
Use explicit CSS module imports for typefaces
Browse files Browse the repository at this point in the history
Instead of using the default entry point of the pakages defined in the
`main` field the CSS modules should be imported directly. This fixes the
imports for tests with Jest that are then handled with the implemented
mock for file imports. It improves the DX by showing that these packages
are CSS styles instead of a JS module and removes the need to add
exception/ignore comments for ESLint. The only disadvantage it that it
might be necessary to update the import when the package maintainer
changes the `main` file when updating to a newer version.

GH-53
  • Loading branch information
arcticicestudio committed Dec 3, 2018
1 parent dda9edd commit 6c7eb7c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/containers/core/Root/Root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ import React, { Fragment } from "react";
import PropTypes from "prop-types";
import { ThemeProvider, createGlobalStyle } from "styled-components";
import modernNormalize from "styled-modern-normalize";

import theme, { globals, normalize } from "styles/theme";

/* eslint-disable import/extensions */
import "inter-ui";
import "typeface-rubik";
import "typeface-source-code-pro";
/* eslint-enable import/extensions */
import "inter-ui/inter-ui.css";
import "typeface-rubik/index.css";
import "typeface-source-code-pro/index.css";

/**
* A React component that injects global CSS inline styles in page headers.
Expand Down

0 comments on commit 6c7eb7c

Please sign in to comment.