HackMD
  • Prime
    Prime  Full-text search on all paid plans
    Search anywhere and reach everything in a Workspace with Prime plan.
    Got it
    • Prime  Full-text search on all paid plans
      Prime  Full-text search on all paid plans
      Search anywhere and reach everything in a Workspace with Prime plan.
      Got it
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
    Menu Sharing Help
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Gist
    Import
    Dropbox Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    Write
    Owners
    • Owners
    • Signed-in users
    • Everyone
    Owners Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Github Pages + Gulp 編譯部署步驟 by Jiang ###### tags: `Jiang` `2021夏季切版班` ## ( 2021 切版班更新 ) :::info #### 課程 Gulp 範例所提供的功能 1. 使用 EJS 做版型管理 1. 支援 SCSS 編譯功能 1. 儲存檔案時,瀏覽器會自動更新,不需持續按 F5 1. 整合 GitHub 服務,能做到一鍵上傳網站空間 #### 參考資料: * [六角學院的 gulp 環境安裝流程](https://hackmd.io/yWpLNMPRT2yvIR4Zq_idGw?view) * [gulp環境建立](https://www.youtube.com/watch?v=mZnMsYVHUkA) * [六角學院的 從 0 到 1 的 GitHub Pages 教學手冊](https://hackmd.io/@Albertnotes/B1_iKcAwI) * [Ray 助教的 注意事項](https://github.com/hexschool/web-layout-training-gulp/blob/master/README.md) #### Gulp 學習資源 * [使用 Gulp 進行網頁前端自動化](https://courses.hexschool.com/p/gulp) * [這是在講 Gulp 不是飲料是任務自動化工具這件事](https://hsiangfeng.github.io/tags/%E9%80%99%E6%98%AF%E5%9C%A8%E8%AC%9B-Gulp-%E4%B8%8D%E6%98%AF%E9%A3%B2%E6%96%99%E6%98%AF%E4%BB%BB%E5%8B%99%E8%87%AA%E5%8B%95%E5%8C%96%E5%B7%A5%E5%85%B7%E9%80%99%E4%BB%B6%E4%BA%8B/page/2/) * [試著把切版專案升級到 gulp4.0 吧](https://ithelp.ithome.com.tw/users/20104132/ironman/2921) ::: ## 檔案直接在終端機操作 ( 在 vscode 內建終端機也一樣指令,只是不需要再 cd ) ### 步驟一:先上傳到遠端 Github pages 基本上就是照著六角學院給的課程影音操作以下步驟 1. 先在 GihubPage 網站先新增一個 repositary,接著**執行以下指令** 1. **win** : 開啟 cmd ---> 輸入 cd ---> 拉進資料夾 ---> 按下 enter ---> 輸入 npm install ---> 輸入 gulp ,若順利會開啟瀏覽器!( win 檔案如果在D槽,請在第一步驟時輸入d: 進入D槽 ---> cd 進入要 gulp 的檔案 ) 1. **mac** : 開啟 terminal ---> 輸入cd --> 拉進資料夾 ---> 按下enter ---> 輸入 npm install (或 sudo npm install) ---> 輸入gulp ,若順利會開啟瀏覽器 1. git init 1. git status 先查看狀態 1. git add . 這個點點一定要加或是可以直接寫要增加的資料夾名稱即可 1. git status 先查看狀態 1. git commit -m "commit" 創建 commit 1. git log 再查看一次版本庫的提交歷史記錄 1. 用 github 頁面給的網址第二個框內的指令 git remote add origin [GitHub Repositories 這個專案頁面上提供的的repo網址] 1. git branch -M main 分支建立 1. git push -u origin main 僅限第一次輸入,往後只需要輸入 git push 提交到遠端 > 執行完 git push -u origin main 或 master 時,系統可能會問你要選擇,這裡大概只會在第一次操作時產生這個情境,必須要輸入 git 帳號密碼( 通常是連結 github 帳密就好 ) > > 1. Web Browser <--- 選這個 > 2. Personal access token > > 供使用者選擇,還請選擇 1。 ### 步驟二:上傳之後要 Gulp 編譯並上傳 dist 當將 Gulp 原始碼初次部署到 GitHub 之後,可以依照以下兩步驟來更新網站 1. 步驟一:輸入 gulp build 進入生產模式 1. 步驟二:輸入 gulp deploy 即可完成 GitHub Pages 部署。 1. 再到 setting 改為 gh-pages 然後 save 2. 查看 gh-pages 是否成功( 此頁面是 build 之後 dist 資料夾提供的內容 ) ### 步驟三:編譯檔案若有更新,要上傳怎麼辦 ? 1. git add . 或是 git add 輸入檔案名稱 1. git status 1. git commit -m "commit" 提交到本機 1. git log 1. git push 提交到遠端 **除了更新的檔案要上傳之外,另外還有 gh-pages 要上傳** 如果是 Gulp 檔案記得重新編譯 gulp build 然後再執行 gulp deploy > **如果在上傳更新檔案這個步驟時,執行此步驟 gulp deploy 失敗怎麼辦 ?** > 可以先把 .publish 檔案刪除,然後再次 gulp deploy 即可上傳 > > ![](https://i.imgur.com/esGRocf.png)

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in via Google

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully