Linking to css files from react index

前端 未结 1 646
执念已碎
执念已碎 2021-01-04 01:04

I have this simple index :







        
1条回答
  •  抹茶落季
    2021-01-04 01:53

    If you want to include css in your html, you gotta put them in your public folder and use '%PUBLIC_URL%' as the path to your css. So it would look something like this:

    
    

    Alternatively, it is highly recommended that you do import the css that you want inside your react component, because your css would get minified and bundled. So you could do something like:

    import React, { Component } from 'react';
    // ... rest of imports
    import './path/to/css/font-awesome.min.css'
    

    For more info on this, go to the documentation here.

    0 讨论(0)
提交回复
热议问题