【发布时间】:2021-02-02 17:23:30
【问题描述】:
我有一个使用 Jekyll 的 GitHub 页面站点(一个项目页面),并且想在我的项目中使用 Bootstrap。
我下载了未编译的 twbs 文件,并在我的项目中的 _sass 目录下添加了 bootstrap、mixins 和实用程序文件夹。
我在我的主 sass 文件中导入 bootstrap,如下所示:
@import 'bootstrap/bootstrap';
当我运行 bundle exec jekyll serve 时,这在本地运行良好。
但是,当我将构建推送到 GitHub Pages 时,我收到以下错误:
Your SCSS file ci-dashboard/assets/css/style.scss has an error on line 2: File to import not found or unreadable: bootstrap/bootstrap. Load path: /hoosegow/.bundle/ruby/2.7.0/gems/jekyll-theme-primer-0.5.4/_sass.
我尝试了以下方法:
- 将此添加到我的 _config.yml 文件中
sass:
sass_dir: _sass
style: compressed
- 按照this post 中的说明,将baseurl 添加到我的config.yml 文件并尝试使用以下行在我的主css 文件中导入引导程序:
@import '{{ site.baseurl }}/bootstrap/bootstrap';
这个解决方案看起来很有希望,因为 jekyll 和 GitHub 页面使用相对链接似乎存在问题?我猜我的导入错误或在错误的地方?
- 按照this post 的建议,将我的.gitignore 文件中的
vendor替换为vendor/bundle。
这是我的项目的结构:
├── _config.yml
├── _sass
│ ├── bootsrap
│ | └──*lots of .scss files*
│ ├── mixins
│ | └──*lots of .scss files*
│ └── utilities
│ └──*lots of .scss files*
├── assets
│ └── css
│ └──style.scss
├── _includes
│ ├── footer.html
│ └── header.html
├── _layouts
│ └── default.html
├── _site
└── Gemfile
etc. etc.
谢谢!
【问题讨论】:
-
也在这里发布github.community/t/…
标签: twitter-bootstrap bootstrap-4 sass jekyll github-pages