All Projects → doczjs → docz-plugin-css

doczjs / docz-plugin-css

Licence: other
This package makes it possible to use preprocessors and css modules on docz

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to docz-plugin-css

Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: ✭ 126 (+207.32%)
Mutual labels:  less, styles
Rollup Plugin Styles
🎨 Universal Rollup plugin for styles: PostCSS, Sass, Less, Stylus and more.
Stars: ✭ 116 (+182.93%)
Mutual labels:  less, styles
Vertical Rhythm
Put some typographical vertical rhythm in your CSS. LESS, Stylus and SCSS/SASS versions included.
Stars: ✭ 83 (+102.44%)
Mutual labels:  less, styles
less-mix
LESS-Mix - is a functional, powerful and convenient library LESS-mixins.
Stars: ✭ 22 (-46.34%)
Mutual labels:  less, styles
OSAPI
👋 OSAPI 是依靠通用性后台管理平台搭建的API管理平台,基于 vue3、Nestjs 技术栈实现,包含 RBAC 角色权限模块、数据展示、编辑等模块。
Stars: ✭ 32 (-21.95%)
Mutual labels:  less
RelaxUI
🥉🥉基于Vue2的UI组件库
Stars: ✭ 96 (+134.15%)
Mutual labels:  less
manage-demo
后台管理系统模版
Stars: ✭ 19 (-53.66%)
Mutual labels:  less
highcharts-themes-collection
Highcharts themes collection
Stars: ✭ 30 (-26.83%)
Mutual labels:  styles
boxshop
Laravel ecommerce platform
Stars: ✭ 78 (+90.24%)
Mutual labels:  less
bleh
A web framework with automatic Browserify + Less + Express + Handlebars
Stars: ✭ 47 (+14.63%)
Mutual labels:  less
less-brunch
Adds LESS support to Brunch
Stars: ✭ 14 (-65.85%)
Mutual labels:  less
Fomantic-UI-LESS
LESS only distribution of Fomantic UI
Stars: ✭ 16 (-60.98%)
Mutual labels:  less
a-pollo
🎨 The visual CSS style guide for teams
Stars: ✭ 14 (-65.85%)
Mutual labels:  less
eadmin
eadmin - 极致用户体验与极简开发并存的开箱即用的后台UI框架
Stars: ✭ 258 (+529.27%)
Mutual labels:  less
question
这是一个答题系统,类似于驾校APP。已经将题目与代码分离,可以将你自己的题目录入使用(目前仅做了单选)。
Stars: ✭ 58 (+41.46%)
Mutual labels:  less
mailspring-matcha-theme
Matcha theme for Mailspring
Stars: ✭ 32 (-21.95%)
Mutual labels:  less
lemonj
A CSS/LESS/SCSS analysis, bad smell check and auto-refactor tools. 一个面向 CSS/LESS/SCSS 的分析、坏味道检查和自动化重构工具。
Stars: ✭ 138 (+236.59%)
Mutual labels:  less
challenge-charlie
Frontend code challenge
Stars: ✭ 71 (+73.17%)
Mutual labels:  less
webpack-typescript-react
Webpack 5 boilerplate with support of most common loaders and modules (see tags and description)
Stars: ✭ 185 (+351.22%)
Mutual labels:  less
awesome-quickapp
🛠 A curated list of awesome quickapp tutorials, articles, projects and resources.
Stars: ✭ 41 (+0%)
Mutual labels:  less

docz-plugin-css

Docz plugin to parse css files inside your documents

Examples

Installation

First of all, install plugin:

$ yarn add docz-plugin-css --dev

After that, use the plugin on your doczrc.js:

// doczrc.js
import { css } from 'docz-plugin-css'

export default {
  plugins: [
    css({
      preprocessor: 'postcss',
      cssmodules: true,
      loaderOpts: {
        /* whatever your preprocessor loader accept */
      }
    })
  ]
}

Choosing PostCSS, Sass, Less or Stylus

Do you can choose how preprocessor your bundler will use just by changing the preprocessor property at the plugin definition:

// doczrc.js
import { css } from 'docz-plugin-css'

export default {
  plugins: [
    css({
      preprocessor: 'sass'
    })
  ]
}

Using CSS Modules

To use css modules, just turn on cssmodules property on your project configuration:

// doczrc.js
import { css } from 'docz-plugin-css'

export default {
  plugins: [
    css({
      preprocessor: 'sass',
      cssmodules: true
    })
  ]
}

After that, to import styles from css modules, just use .module.{preprocessor-ext} on your files

---
name: Button
----

import { Playground } from 'docz'

import { Button } from './Button'
import { styles } from './styles.module.css'

# Button

Example of Button component with custom class!

<Playground>
  <Button className={styles.custom}>
    Click me
  </Button>
</Playground>

If you don't pass .module in front of the preprocessor extension, bundler will don't parse your css as cssmodule!

If in your project some places use both CSS modules and some place doesn't, you can leave out the cssmodules option so that webpack can determined by itself the correct way to load the CSS.

Multiple pre-processor

You can still use multiple pre-processor together in the same configuration:

// doczrc.js
import { css } from 'docz-plugin-css'

export default {
  plugins: [
    css({ preprocessor: 'sass' }),
    css({ preprocessor: 'stylus' }),
  ]
}

Api

Params

preprocessor

  • Type: postcss | sass | less | stylus
  • Default: postcss

Use to define the preprocessor you want to use

cssmodules

  • Type: Boolean
  • Default: false

Use this option if you want to use css modules

loaderOpts

  • Type: { [key:string]: any }
  • Default: {}

Custom options passed on pre-processor loader configuration

cssOpts

  • Type: { [key:string]: any }
  • Default: {}

Custom options passed on css-loader configuration

ruleOpts

  • Type: { [key:string]: any }
  • Default: {}

Custom options passed on webpack rule configuration

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].