Code Monkey home page Code Monkey logo

Comments (4)

karatechops avatar karatechops commented on June 14, 2024 6

Hi @blakehilliard, this is an interesting question. There may be a few work arounds but the easiest may be creating a custom theme based off the HPE theme. With this approach your HPE theme will stay version controlled and up-to-date.

import { hpe } from 'grommet-theme-hpe';
import { deepMerge } from 'grommet/utils';
import { Grommet } from 'grommet';

const theme = deepMerge(hpe, {
  global: {
    font: {
      family: "'Metric', Arial, sans-serif",
      face: `
        @font-face {
          font-family: "Metric";
          src: url("/public/MetricHPE-Web-Regular.woff") format('woff');
        }
        @font-face {
          font-family: "Metric";
          src: url("/public/MetricHPE-Web-Bold.woff") format('woff');
          font-weight: 700;
        }
        @font-face {
          font-family: "Metric";
          src: url("/public/web/MetricHPE-Web-Semibold.woff") format('woff');
          font-weight: 600;
        }
        @font-face {
          font-family: "Metric";
          src: url("/public/MetricHPE-Web-Light.woff") format('woff');
          font-weight: 100;
        }
      `,
    },
  },
});

export const MyApp = () => <Grommet theme={theme}></Grommet>;

In this approach we assume you have a static assets directory in your web app titled /public that is serving the .woff files. You can find the font file links in the src.

If you do not have a static assets directory in your app you could take a more advanced approach by base64ing the fonts and putting the output directly in the src field of the @font-face definition.

from grommet-theme-hpe.

Mohtashim-Sonasoft avatar Mohtashim-Sonasoft commented on June 14, 2024 1

This is my theme.js file
image

and this one is my main.css file

image

while I am using this way my font works properly.
Thanks!

from grommet-theme-hpe.

karatechops avatar karatechops commented on June 14, 2024 1

Looks like you're good to go. Let us know if you have any other questions!

from grommet-theme-hpe.

Mohtashim-Sonasoft avatar Mohtashim-Sonasoft commented on June 14, 2024

Yes! this link help me partially. Whenever I had to use global--> font--> family and face both keys and values so it was not working while I had use only family key and value here and font-face defined in my main.css file so its work properly.

Thanks for your response.

from grommet-theme-hpe.

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.