gatsby

How to fix the console warning “The resource … was preloaded using link preload but not used within a few seconds from the window's load event”?

笑着哭i 提交于 2021-01-21 10:43:11
问题 I'm developing a gatsby theme/starter for PWA's, but I can't seem to get rid of the following console warning: The resource https://davidde.github.io/gatsby-starter-simpwa/page-data/offline-plugin-app-shell-fallback/page-data.json was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally. On first load everything works fine; the service worker registers like it should and

How to fix the console warning “The resource … was preloaded using link preload but not used within a few seconds from the window's load event”?

99封情书 提交于 2021-01-21 10:40:08
问题 I'm developing a gatsby theme/starter for PWA's, but I can't seem to get rid of the following console warning: The resource https://davidde.github.io/gatsby-starter-simpwa/page-data/offline-plugin-app-shell-fallback/page-data.json was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally. On first load everything works fine; the service worker registers like it should and

如何把 Django 项目部署到服务器?

China☆狼群 提交于 2021-01-20 10:52:36
Django 官网截图 Django 是什么? Django 是基于 Python 开发的一款开源的 Web 应用框架。Django框架不但提供了完善的代码目录结构,而且使用了 Model, View, 和Template的结构,使得代码在开发过程中很容易被规范起来。其中Django Admin提供了开箱即用的后台管理系统而深得众多Python开发者和初创公司喜爱。 21云盒提供了极简单的 Django 部署方法,你可以在21云盒子上通过以 Python 环境进行部署。 如何部署? 注册成为 21云盒子会员 创建一个 PostgreSQL数据库 Fork django示例 在21云盒子上创建一个 云服务 , 并允许21云盒子访问你的代码库 配置以下设定 环境 PYTHON 3.7 构建命令 : ./build.sh 启动命令 : gunicorn hello.wsgi:application 点 进阶配置 进行环境变量配置: KEY VALUE DJANGO_DB_URL 在第一步创建云数据库里中点 数据库URL 获取 DJANGO_ALLOWED_HOSTS <服务名>.21yunbox.com,127.0.0.1 更多Django相关的配置可以参考 官方文档 。 在本示例中, DJANGO_DEBUG=True 只作演示。真实上线时可以在环境变量中把 DJANGO_DEBUG

Import SVG as a component in Gatsby

喜欢而已 提交于 2021-01-15 15:46:42
问题 I've seen the following solution: import { ReactComponent as Img } from 'path/to/file.svg' But in Gatsby, this doesn't work. I know exist plugins for this, but maybe it can be done more easily. 回答1: As you said, there are plugins to achieve this, which means a cleaner code (not the full SVG tag inlined in the component) with the same final result. Using gatsby-plugin-react-svg plugin you just need to import your SVG like this: import Icon from "./path/assets/icon.svg"; To install, you only

STL-vector

不羁的心 提交于 2021-01-13 21:15:36
[TOC] 成员变量 typedef T value_type; typedef value_type* iterator; iterator start; iterator finish; iterator end_of_storage; vector迭代器类型就是普通指针类型。 内部维护三个指针,start指向内存起始处,finish指向下一个放内存的地址,end_of_storage指向可用内存末尾。 迭代器 vector的迭代器就是普通指针: iterator begin() noexcept { return start; } const_iterator begin() const noexcept { return start; } iterator end() noexcept { return finish; } const_iterator end() const noexcept { return finish; } const_iterator cbegin() const noexcept { return start; } const_iterator cend() const noexcept { return finish; } 构造函数 以 vector(size_type n, const value_type& value) 为例。

gatsby-source-graphql + ACF fields not showing up

佐手、 提交于 2021-01-05 10:26:45
问题 I'm wondering why my ACF fields are not showing up in my gatsby app using the gatsby-source-graphql plugin? My ACF fields show up when I use the WP plugin: WP GraphiQL, but not when I run my gatsby app. Can I only import ACF fields using gatsby-source-wordpress??? Everything else seems to show up. I have a custom post type that I'm using no problem, but ACF fields are the issue. Any help would be amazing, Thanks, Spencer They show up in WP backend: But do not show up when Gatsby runs: Here is

How to declare array from API in place of hardcoded array?

╄→гoц情女王★ 提交于 2021-01-05 07:35:15
问题 I was given an example for some code that has an array hardcoded. Im looking to swap this out for my array that is pulled in from an API using graphql. Below is the code pen to the original example & another for what i've tried with no avail. I'm pretty new to graphql & js so likely an amateur mistake, any pointers would be much appreciated! Original code - https://codesandbox.io/s/nice-saha-gwbwv My pen - https://codesandbox.io/s/quiet-wind-brq8s?file=/src/App.js 回答1: I would change your

How to declare array from API in place of hardcoded array?

扶醉桌前 提交于 2021-01-05 07:33:42
问题 I was given an example for some code that has an array hardcoded. Im looking to swap this out for my array that is pulled in from an API using graphql. Below is the code pen to the original example & another for what i've tried with no avail. I'm pretty new to graphql & js so likely an amateur mistake, any pointers would be much appreciated! Original code - https://codesandbox.io/s/nice-saha-gwbwv My pen - https://codesandbox.io/s/quiet-wind-brq8s?file=/src/App.js 回答1: I would change your

如何把 Jekyll 项目部署到服务器?

浪尽此生 提交于 2021-01-04 23:10:10
Jekyll 是什么? Jekyll 是一个基于 Ruby 开发者的静态网站生成器。是最早的一批静态网页生成器之一,有丰富的第三方插件,深受 Ruby 开发者喜爱。 21云盒提供了极简单的 Jekyll 部署方法,你可以在21云盒子上通过以 静态网页 环境的方式进行部署。 如何部署? 注册成为 21云盒子会员 在 Gitee 上 Fork Jekyll示例 在21云盒子上创建一个 云服务 , 并允许21云盒子访问你的代码库 用下面配置进行创建 环境 静态网页 构建命令 bundle install && bundle exec jekyll build 发布目录 ./_site 为什么部署在21云盒子? 原因 1: 方便 21云盒子创立至今,在国内第一家真正提供了像 Netlify, Heroku 等轻松部署的功能,同时也保证了服务的速度和稳定性。 每个云服务项目,只需要在首次完成 2 项配置,后续当你Git Push代码,21云盒子就会帮你完成自动部署。 原因 2: 21云盒子稳定,提供网站备案方案 如果你的网站现在使用的是 Netlify, Vercel, Gatsby Cloud等服务,国内用户将没办法访问。 为什么呢? 根据国家工信部的要求,所有在国内上线的网站都必先完成备案, 但国外的云服务平台不提供国内的的备案,所以部署在国外的云服务平台,或许能暂时访问,但长远来看

How do you publish a gatsby project with gatsby-image on Netlify?

随声附和 提交于 2021-01-02 03:47:37
问题 So I can locally build my gatsby project no problem, but when Netlify tries to build, I get the error Field "featuredImage" must not have a selection since type "String" has no subfields. 5:34:38 PM: This can happen if you e.g. accidentally added { } to the field "featuredImage". If you didn't expect "featuredImage" to be of type "String" make sure that your input source and/or plugin is correct. 5:34:38 PM: error There was an error in your GraphQL query: 5:34:38 PM: Field "featuredImage"