- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试构建我的项目,但在构建过程中出现错误。我输入了这个命令:
yarn build
然后我看到了这个:
ERROR in ./assets/css/main.css (./node_modules/@nuxt/postcss8/node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/@nuxt/postcss8/node_modules/postcss-loader/dist/cjs.js??ref--3-oneOf-1-2!./assets/css/main.css)
Module build failed (from ./node_modules/@nuxt/postcss8/node_modules/css-loader/dist/cjs.js):
Error: Can't resolve '~/static/fonts/farsi/eot/iranyekanwebregular.eot' in '/Users/mohammadamin/WebstormProjects/TicaTeb/assets/css'
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:209:21
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:672:1)
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/AliasPlugin.js:67:43
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:285:5
at eval (eval at create (/Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
at /Users/mohammadamin/WebstormProjects/TicaTeb/node_modules/enhanced-resolve/lib/Resolver.js:285:5
@ ./assets/css/main.css 4:14-217
@ ./.nuxt/App.js
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/client.js
我必须提到项目在 Windows 10 上成功构建,但是当我在 MacBook Air M1 上输入构建命令时出现此错误。我不得不用 sass 替换 node-sass 因为 node-sass 与 M1 不兼容
我尝试了不同的方法,例如将 ~assets/fonts 替换为 ~/static/fonts 或只是/font/... 但它们都失败了。
这是我的 package.json:
{
"name": "TicaTeb-Front",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
},
"dependencies": {
"@nuxt/postcss8": "^1.1.3",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/i18n": "^7.2.0",
"cookie-universal-nuxt": "^2.1.5",
"core-js": "^3.15.1",
"jalali-moment": "^3.3.11",
"nuxt": "^2.15.7",
"v-mask": "^2.3.0",
"vue-js-modal": "^2.0.1",
"vue-toasted": "^1.1.28",
"vue2-touch-events": "^3.2.2",
"vuelidate": "^0.7.6"
},
"devDependencies": {
"@nuxtjs/color-mode": "^2.1.1",
"@nuxtjs/pwa": "^3.3.5",
"@nuxtjs/tailwindcss": "^4.2.1",
"autoprefixer": "^10.4.7",
"sass": "~1.32.6",
"sass-loader": "10.1.1",
"tailwindcss-dir": "^4.0.0"
}
}
这是我的 nuxt.config.js:
import i18nOptions from './plugins/i18n/options.js'
export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'server',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'TicaTeb | تیکاطب',
htmlAttrs: {
type: 'text/html; charset=utf-8'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ itemprop: 'name', content: 'TicaTeb' },
{ property: 'og:type', content: 'website' },
{ property: 'og:site_name', content: 'ticateb.ir' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'theme-color', content: '#0048C5' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'@/assets/css/main.css',
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'~/plugins/i18n/i18n.js',
'~/plugins/hybridLink.js',
'~plugins/vue-js-modal.js',
'~plugins/vue2-touch-events.js',
'~/plugins/vuelidate.js',
'~/plugins/englishDigit.js',
'~/plugins/decimalPlaces.js',
'~/plugins/preventLeadingZeroes.js',
{ src: '~/plugins/toasted.js', mode: 'client' },
{ src: '~/plugins/vueMask.js', mode: 'client' },
],
router: {
middleware: ['i18n']
},
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
'@nuxt/postcss8',
'@nuxtjs/tailwindcss',
'@nuxtjs/color-mode',
'@nuxtjs/pwa'
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
['@nuxtjs/i18n', i18nOptions],
'@nuxtjs/axios',
'cookie-universal-nuxt'
],
colorMode: {
preference: 'dark', // default value of $colorMode.preference
fallback: '', // fallback value if not system preference found
hid: 'nuxt-color-mode-script',
globalName: '__NUXT_COLOR_MODE__',
componentName: 'ColorScheme',
classSuffix: '',
storageKey: 'Theme'
},
loading: {
color: '#0048C5',
height: '4px',
rtl: true,
throttle: 0
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
},
pwa: {
manifest: {
name: 'تیکاطب تفسیر آنلاین آزمایش',
short_name: 'تیکاطب',
lang: 'fa',
display: 'standalone',
theme_color: '#0048C5',
background_color: '#ffffff',
},
icon: {
fileName: 'TicaTebLogo.png',
sizes: [64, 120, 144, 152, 192, 384, 512]
}
}
}
这是 main.css:
@font-face {
font-family: iranyekan;
font-style: normal;
font-weight: normal;
src: url('~/static/fonts/farsi/eot/iranyekanwebregular.eot');
src: url('~/static/fonts/farsi/eot/iranyekanwebregular.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('~/static/fonts/farsi/woff/iranyekanwebregular.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('~/static/fonts/farsi/woff2/iranyekanwebregular.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('~/static/fonts/farsi/ttf/iranyekanwebregular.ttf') format('truetype');
}
@font-face {
font-family: iranyekan;
font-style: normal;
font-weight: 500;
src: url('~/static/fonts/farsi/eot/iranyekanwebmedium.eot');
src: url('~/static/fonts/farsi/eot/iranyekanwebmedium.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('~/static/fonts/farsi/woff/iranyekanwebmedium.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('~/static/fonts/farsi/woff2/iranyekanwebmedium.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('~/static/fonts/farsi/ttf/iranyekanwebmedium.ttf') format('truetype');
}
@font-face {
font-family: iranyekan;
font-style: normal;
font-weight: bold;
src: url('~/static/fonts/farsi/eot/iranyekanwebbold.eot');
src: url('~/static/fonts/farsi/eot/iranyekanwebbold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('~/static/fonts/farsi/woff/iranyekanwebbold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('~/static/fonts/farsi/woff2/iranyekanwebbold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('~/static/fonts/farsi/ttf/iranyekanwebbold.ttf') format('truetype');
}
@font-face {
font-family: iranyekan;
font-style: normal;
font-weight: 800;
src: url('~/static/fonts/farsi/eot/iranyekanwebextrabold.eot');
src: url('~/static/fonts/farsi/eot/iranyekanwebextrabold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */
url('~/static/fonts/farsi/woff/iranyekanwebextrabold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('~/static/fonts/farsi/woff2/iranyekanwebextrabold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/
url('~/static/fonts/farsi/ttf/iranyekanwebextrabold.ttf') format('truetype');
}
.page-enter-active,
.page-leave-active {
transition: all 250ms ease-out;
}
.page-enter,
.page-leave-active {
opacity: 0;
transform-origin: 50% 50%;
}
@tailwind base;
@layer base {
html {
font-family: iranyekan, serif !important;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type=number] {
-moz-appearance: textfield;
}
}
@tailwind components;
@layer components {
.text-title {
@apply text-gray-dark dark:text-white
}
.hero-card {
background: radial-gradient(circle farthest-side, #0e74b3 1%, #0048C5 75%);
}
.card-box {
@apply bg-white dark:bg-black-800 rounded-10
}
.hero-button, .hero-button-reverse, .service-button {
background-image: linear-gradient(to right, #044DCC, #257FE1);
z-index: 1;
@apply relative transition-all duration-300
}
.hero-button-reverse {
background-image: linear-gradient(to right, #257FE1, #044DCC);
}
.service-button {
background-image: linear-gradient(to bottom right, #257FE1, #0048C5);
}
.hero-button::before, .hero-button-reverse::before, .service-button::before {
content: "";
background: linear-gradient(to right, #FF6B00, #FF974B);
z-index: -1;
@apply absolute inset-0 transition-all duration-300 opacity-0 rounded-12
}
.hero-button:hover {
@apply translate-x-[20px]
}
.hero-button-reverse:hover {
@apply translate-x-[-20px]
}
.service-button:hover {
@apply translate-y-[-8px]
}
.hero-button:hover::before, .hero-button-reverse:hover::before, .service-button:hover::before {
@apply opacity-100
}
.custom-input {
@apply relative
}
.custom-input label {
@apply absolute top-[-12px] rtl:right-[30px] ltr:left-[30px] text-title z-20 bg-white dark:bg-black-800 px-[4px] text-[16px]
}
.custom-input div {
@apply bg-transparent border border-[0.6px] rounded-5 w-full
}
.custom-input div input {
@apply bg-transparent text-title px-16 py-[13px] text-[14px] w-full outline-none
}
.red-dot {
@apply bg-red w-[6px] h-[6px] rounded-full min-w-[6px]
}
.custom-radio {
@apply flex items-center;
}
.custom-radio input[type="radio"]:focus {
@apply outline-none rounded-full;
}
.custom-radio input[type="radio"] {
@apply cursor-pointer w-16 h-16 min-w-[16px] relative appearance-none rounded-full mx-8;
}
.custom-radio input[type="radio"]::before {
content: '';
border: 1px solid #7580A0;
@apply absolute inset-0 rounded-full;
}
.custom-radio input[type="radio"]:focus::before {
@apply shadow-none;
}
.custom-radio input[type="radio"]:checked::before {
border: 5px solid;
@apply border-[#1F2434] dark:border-[#ffffff];
}
.custom-radio label {
@layer text-title;
@apply text-[14px] mb-0 align-middle text-center self-center cursor-pointer select-none;
}
.btn-primary {
@apply flex items-center justify-center bg-primary-dark rounded-5 w-full text-white font-bold text-[16px] py-[10px] transition-all duration-200 hover:bg-[#FF6B00]
}
.btn-secondary {
@apply flex items-center justify-center bg-gray-dark rounded-5 w-full text-white font-bold text-[16px] py-[10px] transition-all duration-200 hover:bg-gray-light
}
}
@tailwind utilities;
@layer utilities {
.dir-rtl {
direction: rtl !important;
}
.dir-ltr {
direction: ltr !important;
}
}
请给我一个提示。谢谢!
最佳答案
确保您的文件名和目录正确且匹配。仔细检查 URL。请注意,基于 Unix 的操作系统区分大小写。 https://www.informit.com/articles/article.aspx?p=1144082&seqNum=4#:~:text=Most%20Unix-style%20operating%20systems,exist%20in%20the%20same%20folder
关于vue.js - Nuxt 2.15.7 构建错误 - 无法解析 CSS @font-face URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72239511/
将以下内容添加到我的键绑定(bind)中可以让我将 Sublime Text 3 中的字体大小重置为默认大小: { "keys": ["ctrl+0"], "command": "reset_font
我有一个如下所示的 css 字体系列(由于显示限制,我已经缩短了它,否则它比我在这里展示的要大得多)现在你能告诉我是否有办法将 url()content 转换为 .ttf 字体格式或其他标准字体格式吗
具体来说... and ...显示为双倍或四倍。 最佳答案 Customize Twitter Bootstrap here. Make sure to uncheck the default "
当包含 @font-face 和 src 以导入网络字体时,我注意到您可以传入 2 个可选值。我目前不这样做。 我有 2 种网络字体,Lato Regular 和 Lato Bold。 我应该在 @f
我正在本地主机上测试一个字体很棒的网站,它工作正常;但是当我将它上传到我的远程站点时,它不再显示字体了。我该如何解决?尝试了所有调试但没有成功。 网站在那里 www.sevotec.it/ordine
我开始使用 font-squirrel (http://www.fontsquirrel.com/tools/webfont-generator) 来快速使我的字体跨浏览器兼容,我只是想知道字体质量是
以前我复制了一个ttf文件到C:\Windows\Fonts,点击文件显示字体,然后点击[安装],一切正常。 当我现在执行此过程时,字体未安装在 C:\Windows\Fonts 中,而是安装在 C:
我注意到,在工作中,Google Web字体未出现在IE9和Firefox 6(Windows和Mac OS)上。所有文件都已加载,但字体从未渲染。在那些相同的浏览器上,它可以在家正常工作。 Chro
我正在学习 Swift UI 教程,我遇到了这个错误,而讲师没有。 .font 错误在第一个 Vstack 中仅出现一次,而第二次则没有问题。 import SwiftUI struct Conten
我知道使用@font-face 允许浏览器下载自定义字体并在网页中使用它,就像使用任何系统字体一样。 我想知道的是浏览器是对字体进行编码还是在不公开的情况下使用它? 谢谢 最佳答案 浏览器无法保护字体
使用基于@font-face 标记的标准fontsquirrel .. 字体呈现在较粗的一面。下面是一个屏幕截图,以几种不同的方式展示了字体。顶部是 photoshop 的渲染图,第二个是相同字体的
我必须在元素中使用花哨的字体,但我真的很想避免使用 sifr 和其他丑陋的替代品,所以我正在寻找@font-face。 但是,我真的很困惑几个博客/网站提供了关于它的可用性的不同观点。准备好了吗?目前
我几乎在我工作的所有项目中都使用 fontawesome。但这次我得到的图标显示为正方形。我还尝试了 stackoverflow 上列出的几乎所有解决方案,但似乎对我的情况没有任何效果。我猜是什么东西
好的,所以我正在尝试让 IE9 显示字体 Agenda。我像往常一样去了 fontsquirrel,它说 font bureau 不允许他们创建字体套件。然后我去了 codeandmore 并在那里制
Font Awesome 4.0是对 Font Awesome 从头开始的完全重写。主要的新功能之一是图标现在具有命名空间。除了命名空间之外,图标还使用基于一致性和可预测性的新命名约定。不幸的是,
我使用版本 3.2.9 (Media Mark) 的 SASS 并且我想使用我的自定义 font-family 的 3 个变体Source Sans Pro 字体(Light、Regular、Bold
在一些 css 文件中嵌入一些 base64 字体,但 CSP 阻止了这些:类似于 url("data:font/woff;base64,d09GRk9UVE...); 当前 CSP =“base-u
我怎样才能使 Font Awesome 图标像本页中那样大: http://fontawesome.io/icon/bath/ 我使用了 fa-5x 类,但它与页面示例中最大的图标不同。 下面是我使用
我有一个带有Bootsrap 4(SASS)和Font Awesome 5的MVC项目。我正在尝试使旋转的图标可以与Ajax加载面板一起使用,但是它不起作用。 Test Spin
似乎 font-awesome 支持自定义图标,并附有详细说明如何创建和提交您自己的图标,但该信息在他们的网站上不再可用。这是否意味着不再支持此功能并且您只能请求由 font-awesome 团队完成
我是一名优秀的程序员,十分优秀!