Search code examples
sassgithub-pages

How to use GitHub primer with GitHub pages


I am trying to use https://github.com/primer/css within GitHub pages.

There are some npm commands but I don't know how to import the files to my project folder.

Adding @import "@primer/css/index.scss"; to my style.css file is not sufficient. I need some sass files but I don't know where to find them after running npm install --save @primer/css. I know that the answer is easy and I read about the --prefix option.

I am sure I am missing something trivial but important. Give me a hint!


Solution

  • Using the CDN mentioned in the primer documentation worked for me:

    <link rel="stylesheet" href="https://unpkg.com/@primer/css@^20.2.4/dist/primer.css" />

    The layout file imports the main.scss file:

    <link rel="stylesheet" href="/assets/css/main.css">

    The main.scss file imports the required file:

    @import url(https://unpkg.com/@primer/css@^20.2.4/dist/primer.css);