DEV Community

sidcode
sidcode

Posted on

[Flutter] Web Github pages

  • already create your repository "your_id.gihub.io"
  • "your_id.github.io" 로 repository가 생성되었다는 기준임
  • already create your flutter web project
  • flutter web 프로젝트를 생성했다는 기준임
  1. if you have to domain, go to the flutter project directory 만약 당신이 도메인을 소유하고있다면, flutter 프로젝트 생성 한 디렉토리로 이동
$ cd my_flutter_directory
$ echo -e 'sidcode.me' > web/CNAME
$ cat web/CNAME         
sidcode.me
Enter fullscreen mode Exit fullscreen mode
  1. flutter web build
$ flutter build web --release
------------------------------  
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 257628 to 1172 bytes (99.5% reduction). Tree-shaking can be disabled by providing
the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 7760 bytes (99.5% reduction). Tree-shaking can be disabled by
providing the --no-tree-shake-icons flag when building your app.
Compiling lib/main.dart for the Web...                           1,407ms
✓ Built build/web
Enter fullscreen mode Exit fullscreen mode
  1. flutter build web page move flutter build된 web페이지로 이동
$ cd build/web/
$ ls -all                                                   
drwxr-xr-x sidcode staff 480 B  Thu Jun 20 15:56:49 2024  .
drwxr-xr-x sidcode staff  96 B  Thu Jun 20 15:56:47 2024  ..
.rw-r--r-- sidcode staff  32 B  Thu Jun 20 15:56:49 2024  .last_build_id
drwxr-xr-x sidcode staff 320 B  Thu Jun 20 15:56:48 2024  assets
drwxr-xr-x sidcode staff 320 B  Thu Jun 20 15:56:47 2024  canvaskit
.rw-r--r-- sidcode staff  13 B  Thu Jun 20 15:51:32 2024  CNAME
.rw-r--r-- sidcode staff 917 B  Wed Feb  1 13:05:06 2023  favicon.png
.rw-r--r-- sidcode staff 7.6 KB Tue Jun  4 21:05:58 2024  flutter.js
.rw-r--r-- sidcode staff 7.9 KB Thu Jun 20 15:56:48 2024  flutter_bootstrap.js
.rw-r--r-- sidcode staff 8.0 KB Thu Jun 20 15:56:49 2024  flutter_service_worker.js
drwxr-xr-x sidcode staff 192 B  Thu Jun 20 15:56:48 2024  icons
.rw-r--r-- sidcode staff 1.2 KB Thu Jun 20 15:56:48 2024  index.html
.rw-r--r-- sidcode staff 1.5 MB Thu Jun 20 15:47:11 2024  main.dart.js
.rw-r--r-- sidcode staff 928 B  Thu Jun 20 15:35:13 2024  manifest.json
.rw-r--r-- sidcode staff 102 B  Thu Jun 20 15:56:48 2024  version.json
Enter fullscreen mode Exit fullscreen mode
  1. git push
$ git init && git add . && git commit -m  "init" && git branch -M gh-pages
===============================================
$ git remote add origin https://github.com/[your_id]/[repo_name].git
 ******** choice not token or token github 
 ******** 깃허브 토큰없거나 토큰 있는 경우 선택 
$ git remote add origin https://[your_id]:[your_token]@github.io/{your_id}/{repo_name}.git
===============================================
$ git push -u origin gh-pages
------------------------------------------------
오브젝트 나열하는 중: 43, 완료.
오브젝트 개수 세는 중: 100% (43/43), 완료.
Delta compression using up to 10 threads
오브젝트 압축하는 중: 100% (37/37), 완료.
오브젝트 쓰는 중: 100% (43/43), 5.50 MiB | 5.07 MiB/s, 완료.
Total 43 (delta 6), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (6/6), done.
To https://github.com/sidcodeme/sidcodeme.github.io.git
 * [new branch]      gh-pages -> gh-pages
branch 'gh-pages' set up to track 'origin/gh-pages'.
Enter fullscreen mode Exit fullscreen mode
  1. github pages setting

OK FINISHED, LET`S GO TO HOMEPAGE!!!!!

Top comments (0)