為何捐款
API 瀏覽器
升級指南
NEW!
quasar.config 檔案
將專案轉換為搭配 Vite 的 CLI
瀏覽器相容性
支援 TypeScript
目錄結構
命令列表
CSS 預處理器
路由
懶加載 - 代碼分割
處理資源
啟動檔案
預取功能
API 代理
處理 Vite
處理 process.env
使用 Pinia 進行狀態管理
使用 Vuex 進行狀態管理
Linter
測試與稽核
開發行動應用程式
Ajax 請求
開放開發伺服器給公眾
Quasar CLI with Vite - @quasar/app-vite
CSS Preprocessors

Sass or SCSS (recommending any of the two flavours) are the out of the box supported css preprocessors through Quasar CLI, should you want to use them.

Configuration

You can configure how your CSS is handled through /postcss.config.cjs and through extending the Vite config

/quasar.config file

build: {
  extendViteConf (viteConf, { isClient, isServer }) {
    viteConf.css.modules = ...
    viteConf.css.postcss = ...
    viteConf.css.preprocessorOptions
  }
}

More info: css.modules, css.postcss, css.preprocessorOptions.

Usage

Your Vue files can contain Sass/SCSS code through the <style> tag.

<!-- Notice lang="sass" -->
<style lang="sass">
div
  color: #444
  background-color: #dadada
</style>
<!-- Notice lang="scss" -->
<style lang="scss">
div {
  color: #444;
  background-color: #dadada;
}
</style>

And, of course, standard CSS is also supported

<style>
div {
  color: #444;
  background-color: #dadada;
}
</style>

Variables

Quasar 也提供變數 ($primary$grey-3,…等等還有更多),您可以直接使用它們。閱讀更多關於 Sass/SCSS 變數 的資訊。