Я работаю с Bootstrap 5 в проекте sass, поддерживаемом веб-пакетом, и хочу настроить семейство шрифтов навигационной панели с помощью переменных SASS. Я пробовал разные подходы, но, кажется, не могу понять это правильно. Вот что я пытался сделать:
в моем файле custom.scss:
Код: Выделить всё
$primary: #FFBE0B;
$secondary: #FB5607;
$success: #3A86FF;
$info: #FF006E;
$light: #8338EC;
@font-face {
font-family: 'Inter-Bold';
src: url('../fonts/inter/Inter-Bold.ttf') format('ttf');
font-weight: normal;
font-style: normal;
}
$navbar-link-font-family: 'Inter-Bold', sans-serif;
$navbar-link-font-size: 16px;
$navbar-link-font-weight: 500;
$navbar-link-color: #333;
$navbar-link-font-family: $navbar-link-font-family;
$navbar-link-font-size: $navbar-link-font-size;
$navbar-link-font-weight: $navbar-link-font-weight;
$navbar-link-color: $navbar-link-color;
$navbar-brand-font-size: 1.5rem;
$font-family-base: $navbar-link-font-family
Код: Выделить всё
@import "./custom.scss";
@import "../../node_modules/bootstrap/scss/bootstrap";
Код: Выделить всё
'use strict'
const path = require('path')
const autoprefixer = require('autoprefixer')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require("webpack");
module.exports = {
mode: 'development',
entry: './src/js/main.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
devServer: {
static: path.resolve(__dirname, 'dist'),
port: 8080,
hot: false
},
plugins: [
new HtmlWebpackPlugin({ template: './src/index.html' }),
new webpack.HotModuleReplacementPlugin(),
],
module: {
rules: [
{
test: /\.(scss)$/,
use: [
{
// Adds CSS to the DOM by injecting a `` tag
loader: 'style-loader'
},
{
// Interprets `@import` and `url()` like `import/require()` and will resolve them
loader: 'css-loader'
},
{
// Loader for webpack to process CSS with PostCSS
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
autoprefixer
]
}
}
},
{
// Loads a SASS/SCSS file and compiles it to CSS
loader: 'sass-loader'
}
]
}
]
}
}
Источник: https://stackoverflow.com/questions/781 ... -variables
Мобильная версия