gitlab - 如何将 sapper/svelte 站点部署到 Gitlab Pages?
问题描述
我正在尝试使用 gitlab 页面来托管由 Sapper 和 Svelte 生成的静态站点。
我使用了入门文档中的 sapper starter 应用程序:
npx degit "sveltejs/sapper-template#rollup" my-app
我将 .gitlab-ci.yml 文件添加为 gitlab 文档指示:
# This file is a template, and might need editing before it works on your project.
image: node:latest
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
pages:
stage: deploy
script:
- npm run export
- mkdir public
- mv __sapper__/export public
artifacts:
paths:
- public
only:
- master
当管道运行时,它说它通过了,但即使经过一天的等待,我仍然会收到 404 错误。
有人用工兵成功地做到了这一点吗?
解决方案
您正在移动导出文件夹,而不是其内容。将您的移动命令更改为
mv __sapper__/export/* public/
这样您的配置将是
# This file is a template, and might need editing before it works on your project.
image: node:latest
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
pages:
stage: deploy
script:
- npm run export
- mkdir public
- mv __sapper__/export/* public/
artifacts:
paths:
- public
only:
- master
推荐阅读
- reactjs - 动态引用 Firestore 文档
- python - 进程如何获取python中全局变量的当前值?
- logstash-grok - SSSD 日志的 Grok 模式
- c# - 根据之前的 appsettings 文件加载自定义 appsettings 文件
- ajax - 在 AjaxLink 中一个接一个地调用几个不同的 JavaScript
- python - Django 中的模板太多
- eclipse - 如何防止 Eclipse 下载 Maven 索引?
- html - 函数将被调用多次
- android - 无法为复选框设置左填充
- vue.js - Symfony:如何将 Sass 文件导入到每个 Vue 组件中