All Projects → changgeee → bit-css

changgeee / bit-css

Licence: MIT license
用原子类赋予元素属性,减少甚至不写css

Programming Languages

Less
1899 projects
javascript
184084 projects - #8 most used programming language
Vue
7211 projects
HTML
75241 projects

Projects that are alternatives of or similar to bit-css

emitty
A platform for finding dependencies between files and building tools for incremental compilation or build.
Stars: ✭ 69 (+263.16%)
Mutual labels:  less, pug, jade
Compile Hero
🔰Visual Studio Code Extension For Compiling Language
Stars: ✭ 169 (+789.47%)
Mutual labels:  less, pug, jade
indent.js
Pure code indentation for jsx, tsx, ts, js, html, css, less, scss.
Stars: ✭ 55 (+189.47%)
Mutual labels:  less, pug
generator-yeomify-landing
Yeoman generator for landing project powered by Gulp
Stars: ✭ 29 (+52.63%)
Mutual labels:  less, pug
Vs Deploy
Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.
Stars: ✭ 123 (+547.37%)
Mutual labels:  less, pug
Bootstrap3 Pug Former jade Node Express Grunt
Bootstrap 3 templated by Jade
Stars: ✭ 242 (+1173.68%)
Mutual labels:  pug, jade
Jade
Jade.go - pug template engine for Go (golang)
Stars: ✭ 251 (+1221.05%)
Mutual labels:  pug, jade
meteor-getting-started
Урок для хабры. Разработка первого метеор приложения.
Stars: ✭ 36 (+89.47%)
Mutual labels:  less, jade
Gulp Starter Kit
A simple Gulp 4 Starter Kit for modern web development.
Stars: ✭ 134 (+605.26%)
Mutual labels:  less, pug
Glup
Some of the gulp tutorial -《gulp笔记》
Stars: ✭ 136 (+615.79%)
Mutual labels:  less, jade
pypugjs
PugJS syntax adapter for Django, Jinja2 and Mako templates
Stars: ✭ 237 (+1147.37%)
Mutual labels:  pug, jade
pretty-harp-jade-skeleton
💀 Harp & Jade/Pug skeleton theme for a personal blog
Stars: ✭ 15 (-21.05%)
Mutual labels:  pug, jade
Pug As Jsx Loader
Stars: ✭ 168 (+784.21%)
Mutual labels:  pug, jade
generator-speedseed
Oriented to components, allow create/choice template, multiple configuration with easy maintenance
Stars: ✭ 13 (-31.58%)
Mutual labels:  less, pug
Laravel Pug
Pug view adapter for Laravel and Lumen
Stars: ✭ 130 (+584.21%)
Mutual labels:  pug, jade
Jade Html5 Boilerplate
HTML5 Boilerplate ported to Jade. Great as a drop and go markup skeleton for Express apps.
Stars: ✭ 111 (+484.21%)
Mutual labels:  pug, jade
Wordless
All the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Stars: ✭ 1,374 (+7131.58%)
Mutual labels:  pug, jade
Node.js Bootstrap Starter Template
Node.js, Express, Pug, Twitter Bootstrap, Starter Template
Stars: ✭ 107 (+463.16%)
Mutual labels:  pug, jade
Vscode Deploy Reloaded
Recoded version of Visual Studio Code extension 'vs-deploy', which provides commands to deploy files to one or more destinations.
Stars: ✭ 129 (+578.95%)
Mutual labels:  less, pug
tale-pug
Tale Pug is the popular JavaScript Template Engine Pug, formerly Jade, for PHP!
Stars: ✭ 32 (+68.42%)
Mutual labels:  pug, jade

bit-css

Features

preview

image

快速体验

包含的属性(class)

  • width(.w-*)
  • height(.h-*)
  • padding(.p-* ,.pt-* ,.pr-* ,.pb-* ,.pl-* ,plr-* ,ptb-*)
  • margin(.m-* ,.mt-* ,.mr-* ,.mb-* ,.ml-* ,mlr-* ,mtb-*)
  • boder-width(.bd-* ,.bdt-* ,.bdr-* ,.bdb-* ,.bdl-*)
  • boder-style(.bd-solid,.bd-dashed,.bd-double)
  • border-radius(.radius-*)
  • 百分比宽高1-100(w-p* ,h-p*)
  • line-height(.lh-*)
  • position(.pst-absl ,.pst-rlt ,.pst-fx)
  • 定位上右下左(.t-* ,.r-* ,.b-* ,.l-* )
  • float(.fl-left,.fl-right)
  • box-sizing(.box-ct,.box-bd)
  • 垂直水平居中(.v,.h,.vh)
  • vertical-align (.vtal-md,.vtal-bt,.vtal-top)
  • display(.dspl-in,.dspl-inbl,.dspl-bl,.dspl-flex,.dspl-infl)
  • flex-wrap(.flex-wrap,.flex-nowrap)
  • justify-content(.jc-start,.jc-end,.jc-center,.jc-between,.jc-around)
  • align-items(.items-start,.items-end,items-center)
  • 水平滑动(.h-scroll)
  • overflow(.ovfl-hd,.ovfl-scroll)
  • overflow-x(ovfl-x-scroll,ovfl-x-hd)
  • overflow-y(ovfl-y-scroll,ovfl-y-hd)
  • color(color--,参考调色板)
  • background(bg--,,参考调色板)
  • border-color(bd--,,参考调色板)
  • text-align(.text-center,.text-left,.text-right)
  • 单行省略(.text-el)
  • 多行省略,2-10(.text-el-*)
  • 折行(.word-wrap)
  • font-size(.fs-*)
  • font-weight(.fw-*)

支持配置的属性

install

# npm package
npm i bit-css --save
# github package
npm --registry https://npm.pkg.github.com  i -D @changgeee/bit-css

usaga

与webpack一起使用

  // npm package
  @import "bit-css";
  // github package
  @import "@changgeee/bit-css";
  // 修改默认变量,ex:
  @unit: rpx;

vue3 需在vue.config.js中加入如下配置

  module.exports = {
    css: {
      loaderOptions: {
        less: {
          lessOptions: {
            javascriptEnabled: true,
          }
        }
      }
    }
  };

单独使用

<!-- dist 目录下含有 375px 尺寸的css压缩文件,如需修改配置,请使用less工具修改编译后手动引入 -->
<script src="bit-css/dist/bit-css.375.px.css"></script>
<!-- unpkg 线上地址 -->
<script src="https://unpkg.com/bit-css/dist/bit-css.375.px.css"></script>  

css体积过大?

  • 推荐使用purgecss相关插件进行无效css剔除
  • 参考./example,使用前css文件73k,使用后0.7k
  • 以vue项目为例,使用purgecss-webpack-plugin(所有使用webpack构建项目同理)
// vue.config.js
const PurgecssPlugin = require('purgecss-webpack-plugin')
const glob = require('glob-all')
const path = require('path')

module.exports = {
  configureWebpack: {
    plugins: [
      new PurgecssPlugin({
        paths: glob.sync([
          path.join(__dirname, './src/index.html'),
          path.join(__dirname, './**/*.vue'),
          path.join(__dirname, './src/**/*.js')
        ])
      })
    ]
  }
}

License

MIT License

Copyright (c) 2020 changge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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].