static site starter
1.0.0
靜態站點啟動器是用於靜態位點的入門模板。
堆棧: babel , browsersync , gulp , minireset.css , pug , sass , webpack 。
# # Serve site at http://localhost:3000 with live reloading
make
此命令還將在第一次運行和package.json
或yarn.lock
文件更新時安裝依賴項。
# # Build site for production use
make build
此命令還將在第一次運行和package.json
或yarn.lock
文件更新時安裝依賴項。
# # List available commands
make help
.
├── documentation-images # PROJECT DOCUMENTATION IMAGES
│
│
├── gulp # GULP/WEBPACK CONFIGURATION AND TASKS
│ ├── env # Gulp configuration per environment
│ │ ├── dev.js # Development environment
│ │ └── prod.js # Production environment
│ │
│ ├── helpers # Gulp helpers
│ │ └── url.js # Helper for URL creation
│ │
│ ├── tasks # Gulp tasks
│ │ ├── pug.js # Pug task declaration
│ │ ├── sass.js # Sass task declaration
│ │ └── script.js # JavaScript task declaration
│ │
│ ├── webpack # Webpack configuration per environment
│ │ ├── common.js # Shared between development and production environments
│ │ ├── dev.js # Development environment
│ │ └── prod.js # Production environment
│ │
│ └── index.js # Script to invoke proper environment and dynamically load Gulp tasks
│
│
├── js # JAVASCRIPT SOURCE FILES
│ ├── foo.js # Sample script imported in scripts.js
│ └── scripts.js # Main JavaScript file used as entry by Webpack
│
│
├── sass # SASS STYLE
│ ├── base # Base style
│ │ ├── _all.sass # Importing all stylesheets
│ │ ├── generic.sass # Style for generic elements (html, body, etc.)
│ │ └── helpers.sass # Helper classes (modifiers)
│ │
│ ├── dev # Development utilities
│ │ ├── shame.sass # WIP style or dirty hacks
│ │ └── structure.sass # Highlighting site structure (import commented by default)
│ │
│ ├── fonts # Fonts style
│ │ ├── _all.sass # Importing all stylesheets
│ │ └── roboto.sass # @font-face style for Roboto
│ │
│ ├── layout # Layout style
│ │ ├── _all.sass # Importing all stylesheets
│ │ └── layout.sass # Very light starter style for structure elements and titles
│ │
│ ├── utilities # Utilities
│ │ ├── _all.sass # Importing all stylesheets
│ │ ├── animations.sass # Some basic animations
│ │ ├── functions.sass # Functions
│ │ ├── mixins.sass # A few useful mixins
│ │ └── variables.sass # Variables for colors, typography, etc.
│ │
│ └── style.sass # Main Sass file used as source by Gulp
│
│
├── site # SITE BUILD DESTINATION FOLDER
│ ├── fonts # Font assets
│ │ └── roboto # Roboto from Google Fonts (TTF, WOFF, WOFF2)
│ │
│ └── images # Image assets
│ ├── favicon.ico # Favicon (placeholder by default)
│ ├── og-image.jpg # Image for og:image meta tag (placeholder by default)
│ └── unicorn.jpg # Sample image
│
│
├── templates # PUG TEMPLATES
│ ├── layouts # Layouts
│ │ └── default.pug # Default layout
│ │
│ ├── partials # Partials
│ │ └── unicorn.pug # Sample partial featuring an image
│ │
│ ├── index.pug # Home page
│ └── page.pug # Sample page
│
│
├── .babelrc # Presets and plugins to use, used by Babel
├── .gitignore # Files and folders ignored by Git
├── .tool-versions # Which version to use locally for each language, used by asdf
├── gulpfile.js # Gulp configuration
├── LICENSE # License
├── Makefile # Commands for this project
├── package.json # JavaScript dependencies, used by Yarn
├── README.md # Project documentation
└── yarn.lock # Tracking exact versions for JavaScript dependencies, used by Yarn
起動器帶有簡單的佈局,結構如下:
// Wrapper
.wrapper
// Header
header .header
.container
…
// Main
main .main
// Section (repeatable)
section .section
.container
…
// Footer
footer .footer
.container
…
還有一個SASS實用程序可以突出顯示站點結構(在開發中非常有用)。只需使用@import "dev/structure.sass"
in style.sass
如果您想使用它。
我們對緩存破壞的策略是將A ?v=[version]
自動添加到每個資產查詢中。當您需要破壞緩存時,只需在package.json
中更新version
即可。
在PUG模板中,可以使用assetVersion
變量。用法:
img ( src = "images/unicorn.jpg" + assetVersion, alt = "" )
在SASS文件中,有一個urlVersion
功能可用。用法:
background-image: urlVersion("/images/unicorn .jpg ")
需要進行一些配置,以獲取title
, description
和og:
準備生產的元標記。您可以在“ Open Graph協議文檔”中閱讀有關OG META標籤的更多信息。
步驟1:在default.pug
中設置以下變量:
- var siteTitle = " Site title " ;
- var siteDescription = " Site description " ;
- var baseUrl = " https://site-url.com " ;
步驟2:為每個頁面設置pageTitle
變量。例如,在index.pug
中:
- pageTitle = " Home " ;
步驟3:自定義OG圖像。
歡迎貢獻,問題和功能請求!請參閱參加該項目的貢獻者列表。
靜態站點啟動器已獲得GNU通用公共許可證v3.0的許可。