0.1.1 • Published 7 years ago

cmui-brush v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Brush

Lightweight utility library for Stylus.

Inspired by nib.

Stylus 是一款 CSS 预处理器,与 Sass 和 Less 相比,Stylus 更像是一门编程语言,功能更为强大和灵活。同时,Stylus 完全基于 JavaScript 开发,对 Node.js 工具链极为友好。

而 Brush 是专为 Stylus 编写的工具库,充分利用 Stylus 的变量、Mixin、插值等特性,为现代 CSS 开发提供更舒适的编程体验。

安装

通过 npm 安装:

$ npm install cmui-brush

使用

在源码中使用

  1. 在你的样式文件中导入 Brush:

    @import './node_modules/cmui-brush/brush'
  2. 随后即可使用 Brush 提供的各项 API。

在构建环节中使用

如果你使用 gulp-stylus 来处理 Stylus 的编译,则可以在编译过程中以插件的方式来加载 Brush。请参考以下代码:

var gulp = require('gulp')
var stylus = require('gulp-stylus')
var brush = require('cmui-brush')

gulp.task('css', function () {
	return gulp.src('./path/to/src/*.styl')
		.pipe(stylus({
			use: [brush()],
		}))
		.pipe(gulp.dest('./path/to/dest/'))
})

谁在用?

移动 UI 框架 CMUI v2 采用 Brush 作为全局的样式工具库,因此所有 CMUI v2 的用户都在使用它:


License

MIT License