#javascript #css
#javascript #css
Вопрос:
Я нашел это index.js на корневом уровне проекта React.
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
ReactDOM.render(
<App />,
document.getElementById('root')
);
Индекс.css:
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
@font-face {
font-family: "Publico-medium";
src: url('./assets/fonts/publico-medium.woff') format('woff');
}
@font-face {
font-family: "Roboto-bold";
src: url('./assets/fonts/roboto-bold.woff') format('woff');
}
@font-face {
font-family: "Roboto-medium";
src: url('./assets/fonts/roboto-medium.woff') format('woff');
}
@font-face {
font-family: "Roboto";
src: url('./assets/fonts/roboto-normal.woff') format('woff');
}
Каковы последствия этого импорта?
Комментарии:
1. Ознакомьтесь с этим: create-react-app.dev/docs/adding-a-stylesheet
Ответ №1:
Из документов React:
In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified .css file in the build output.
Ссылка:https://create-react-app.dev/docs/adding-a-stylesheet /
Комментарии:
1. Итак, в моем случае, поскольку я не создаю классы css в своей таблице стилей, я сбрасываю свойства тела во всем приложении?