resource/assets/SCSS 文件中 @import 路径怎么写?

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
  • resource/assets/sass/app.css 这里引入外部 @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap 里面的 css(scss) 文件, 路径开头怎么就直接是 node_modules 呢 ?

  • 如果按项目根目录的话, 是不是, 在前面加个 / , 就变成

    @import "/node_modules/bootstrap-sass/assets/stylesheets/bootstrap

    ps: 我试过加上 / 就不能编译了

  • 使用相对路径的话, 一步步上级文件夹, 可以正确编译

    @import "../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

    但还是不知道直接 @import "node_modules..." 是什么道理

  • 以下也可以正确编译, ~ 应该就是表示 node_modules/

    @import "~bootstrap-sass/assets/stylesheets/bootstrap";
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1
followyounger

这个应该是npm会去识别的吧。使用的话,是使用的编译好的文件。public/css/app.css

6年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!