Git Product home page Git Product logo

helloworld-vite's Introduction

Hello World - Vite

https://kenkenpa198.github.io/helloworld-vite/

1. Commands

1.1. npm create

$ npm create vite@latest
✔ Project name: … practice-vite
✔ Select a framework: › Vanilla
✔ Select a variant: › JavaScript
...
Done. Now run:

  cd practice-vite
  npm install
  npm run dev

1.2. npm install && npm run dev

$ cd practice-vite
$ npm install

added 11 packages, and audited 12 packages in 1s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ npm run dev

> [email protected] dev
> vite


  VITE v5.0.11  ready in 120 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

1.3. npm run build && npm run preview

$ npm run build

> [email protected] build
> vite build

vite v5.0.11 building for production...
✓ 7 modules transformed.
dist/index.html                 0.45 kB │ gzip: 0.29 kB
dist/assets/index-X4m0RMh6.css  1.21 kB │ gzip: 0.63 kB
dist/assets/index-xf4JlvXi.js   2.59 kB │ gzip: 1.38 kB
✓ built in 87ms

$ npm run preview

> [email protected] preview
> vite preview

  ➜  Local:   http://localhost:4173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

2. Deploy by GitHub Pages

README 冒頭の公開ページを GitHub Pages でデプロイするまでのメモ。

  1. プロジェクトルートへ vite.config.js を作成する。

    cd practice-vite
    touch vite.config.js
  2. ルートディレクトリの設定を記述する。

    GitHub リポジトリが https://github.com/<USERNAME>/<REPO> の場合は '/<REPO>/' を記述する。

    export default {
        base: '/helloworld-vite/',
    }
  3. GitHub Actions の YAML ファイルを作成する。

    mkdir -p .github/workflows
    touch .github/workflows/main.yml
  4. main.yml静的サイトのデプロイ | Vite > GitHub Pages 上のサンプルコードを記述する。

    # 静的コンテンツを GitHub Pages にデプロイするためのシンプルなワークフロー
    name: Deploy static content to Pages
    ...
  5. GitHub リポジトリページ > Settings > Pages へ遷移する。

  6. Build and deployment > Source のプルダウンメニューから GitHub Actions を選択する。

  7. プッシュする。

  8. main ブランチを元に、npm パッケージのインストール ~ ビルド ~ デプロイが行われたことを確認する。

3. References

helloworld-vite's People

Contributors

kenkenpa198 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.