sss和引导问题与导入scss文件 [英] sass and bootstrap issue with importing scss file

查看:229
本文介绍了sss和引导问题与导入scss文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

M使用带有引导程序4的sass现在我在这里做的是sass文件夹,我有app.scss文件,其中我有

M using sass with bootstrap 4 n now what i do here is sass folder i have app.scss file wherein i have

@import _customVariables.scss
@import node_modules/bootstrap/scss/functions
@import node_modules/bootstrap/scss/mixins

当我编译sass文件时,出现以下错误

when i compile the sass file i get the following error

sass --watch app.scss:style.css
 Error: Expected string.
 @import _customVariables.scss
         ^
 app.scss 1:9  root stylesheet

就像新手一样,是不是要导入文件

as m newbie to sass y is it not importing the files

仅当我拥有整个引导程序时它才适用于以下情况

it works for the following only when i have the entire bootstrap it comiples

  @import "../node_modules/bootstrap/scss/bootstrap"

任何帮助将不胜感激

推荐答案

由于使用的是scss,因此应使用字符串作为导入值,并省略下划线:

Since you are using scss you should use string for the import value and omit the underscore:

@import 'customVariables.scss';

根据SASS文档( https://sass-lang.com/guide#import):

As per SASS documentation (https://sass-lang.com/guide#import):

假设您有几个Sass文件,_reset.scss和base.scss.我们想将_reset.scss导入base.scss.

Let's say you have a couple of Sass files, _reset.scss, and base.scss. We want to import _reset.scss into base.scss.

@import 'reset';


编辑:提供一个有效的示例,以便OP能够查看所有相关部分的协同工作.


EDIT: Provide a working example so the OP is able to see all dependent parts working together.

我已经在codeandbox上创建了一个项目,在其中添加了sassbootstrap,并使用了引导程序上的指南来对构建进行主题化:

I've created a project on codesandbox, where I've added sass and bootstrap and used the guide on bootstrap to theme the build:

https://codesandbox.io/s/v0k9wlwqx3

这篇关于sss和引导问题与导入scss文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆