Add Font to Bundleconfig

Asked

Viewed 162 times

0

I’m looking to put a source who is in a link, tried these two ways and none works, simply my page does not load the source. It follows codes:

First form:

var linkFont = "http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all";
                bundles.Add(new StyleBundle("~/lib/metronic/assets/global/css").Include(
                    "~/lib/metronic/assets/global/css/components.min.css",
                     "~/lib/metronic/assets/global/css/plugins.min.css"));

Second form:

bundles.Add(new StyleBundle("~/lib/metronic/assets/global/css").Include(
                "~/lib/metronic/assets/global/plugins/font-awesome/css/font-awesome.min.css",
                "~/lib/metronic/assets/global/css/components.min.css",
                 "~/lib/metronic/assets/global/css/plugins.min.css"));

What would be my mistake?

____EDIT add head

<head>
    <meta charset="utf-8" />
    <title>Metronic Admin Theme #2 | Blank Page Layout</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <link href="/lib/metronic/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet"/>
    <link href="/lib/metronic/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/lib/metronic/assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet"/>
    <link href="/lib/metronic/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/lib/metronic/assets/global/css/components.min.css" rel="stylesheet"/>
    <link href="/lib/metronic/assets/global/css/plugins.min.css" rel="stylesheet"/>

    <link href="/lib/metronic/assets/layouts/layout2/css/layout.min.css" rel="stylesheet"/>
    <link href="/lib/metronic/assets/layouts/layout2/css/themes/blue.min.css" rel="stylesheet"/>

</head>
  • Open the browser console and see errors that have occurred.

  • the only errors that appear are images that I’m not using yet in my theme.

  • Are you in Chrome? If not, try checking the console by Chrome, if it is already and there are no font and/or css errors press Ctrl+U and copy the generated "source" and put here the part where the styles are. Did you understand?

  • added the header as I am using Chrome and no errors appeared

  • This weird, because the CSS looks OK, the fonts are in that folder?

  • The sources tbm is ok, if I click on the link generated in the "source" it opens the source file. If you add the same as the first way via HTTP, the link doesn’t even appear in my head. Another question, if I go manually in the code and add the link, works the fonts perfectly.

  • But the second way causes some error in the console?

  • Try to add this first of all bundles.UseCdn = true;

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.