六角學院 - HexSchool
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
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
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: 網頁切版直播班 - 2022 夏季班 --- [專案下載](https://github.com/hexschool/web-layout-training-gulp/tree/feature/tailwind ) # Tailwind 搭配 Gulp 的使用手冊 ## 第一次開啟專案指令 ``` npm install gulp ``` * 之後開啟只需要輸入 gulp 即可 * 終端機不要關,儲存檔案時才能持續進行語法編譯 ## tailwind.config.js Tailwind 的設定檔,可以用來新增斷點、格線、顏色、等等各種 CSS 的客製化和套件 > 撰寫方式是 JavaScript 的陣列與物件 ### 格線設定 當我們想要利用 Tailwind padding 去做出格線系統時: ```htmlembedded= <div class="container mx-auto px-3"> <div class="flex flex-wrap -mx-3"> <div class="w-1/2 px-3"></div> <div class="w-1/2 px-3"></div> </div> </div> ``` 不過 Tailwind 文件中有提供 container [預設置中與水平 padding](https://tailwindcss.com/docs/container#centering-by-default) 的作法,我們就可以透過在 tailwind.config.js 設定 container 來省去每次撰寫的 `mx-auto` 和 `px-3`。 依照我們的設計稿左右 padding 的數字去修改的話,會是以下範例: > 在 theme 物件中新增 container 的設定 ```javascript module.exports = { content: ["./app/**/*.{html,ejs}"], theme: { container: { center: true, padding: "12px" }, }, } ``` 所以當我們在 HTML 中使用 .container 時就會變成以下範例,container 可以做到置中和左右 padding 留 12px 囉! ```htmlembedded <div class="container"> <div class="flex flex-wrap -mx-3"> <div class="w-1/2 px-3"></div> <div class="w-1/2 px-3"></div> </div> </div> ``` ### 主色設定 設計師提供的設計稿都會有不同的主題色,當色碼與 Tailwind 預設提供的都不符合時,我們可以透過 tailwind.config.js 自己設定顏色,Tailwind 文件中提供[自定義顏色](https://tailwindcss.com/docs/customizing-colors#color-object-syntax)的作法。 以第四週設計稿舉例,設計師提供了紅色的三個變體: <div style="display:flex;"> <img src="https://i.imgur.com/BN7tqs4.png"> <img src="https://i.imgur.com/VXv9k5A.png"> </div> 我們可以設定 colors 物件來新增顏色,我使用了 maroon 當作紅色的名字 > 1. extend 物件代表要在 Tailwind 額外新增新的顏色,若沒使用 extend 會直接將 Tailwind 原本的顏色都覆蓋過去 > 2. light 代表紅色的淺色、DEFAULT 代表紅色、dark 代表深紅色 ```javascript extend: { colors: { 'maroon': { 'light': '#FBF2F2', DEFAULT: '#AA0601', 'dark': '#650300' } }, }, ``` 所以當我們在 HTML 中使用時就會變成以下範例 文字顏色: ```htmlembedded <p class="text-maroon">文字 - 紅色</p> <p class="text-maroon-light">文字 - 紅淺色</p> <p class="text-maroon-dark">文字 - 紅深色</p> ``` 背景色: ```htmlembedded <p class="bg-maroon">背景 - 紅色</p> <p class="bg-maroon-light">背景 - 紅淺色</p> <p class="bg-maroon-dark">背景 - 紅深色</p> ``` ## 字體設定 [官網文件說明連結](https://tailwindcss.com/docs/font-family#customizing-the-default-font) 以第四週設計稿為例,中文使用 Noto Sans TC ,英文使用 Roboto,因為是外部的字體,所以我們可以到 Google Fonts 先進行下載。 ```css <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&family=Roboto:ital,wght@0,400;0,700;1,900&display=swap" rel="stylesheet"> ``` 接著在 css 檔案中設定字體,字體是通用設定,所以可以利用 @layer base 來寫: ```css @layer base { html { font-family: 'Roboto', 'Noto Sans TC' , system-ui, sans-serif; } } ``` 存檔回到畫面上就可以看到中英文的字體改變囉!

    Import from clipboard

    Paste your markdown or webpage here...

    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 lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    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 with Wallet
    Wallet ( )
    Connect another wallet

    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

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    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 and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    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.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        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
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

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

        Syncing

        Push failed

        Push successfully