Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
Modify the project name #3, update Gulp / Grunt document
Browse files Browse the repository at this point in the history
  • Loading branch information
Ҽ˿ committed Dec 5, 2014
1 parent f757fc2 commit 2a9c152
Showing 1 changed file with 41 additions and 22 deletions.
63 changes: 41 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# PostCSS Custom Selector [![Build Status](https://travis-ci.org/postcss/postcss-custom-selector.svg)](https://travis-ci.org/postcss/postcss-custom-selector)
# PostCSS Custom Selectors [![Build Status](https://travis-ci.org/postcss/postcss-custom-selector.svg)](https://travis-ci.org/postcss/postcss-custom-selector)

> [PostCSS](https://github.com/postcss/postcss) 实现 [W3C CSS Extensions(Custom Selectors)](http://dev.w3.org/csswg/css-extensions/#custom-selectors) 的插件。


## 安装(暂未发布)
## 安装

$ npm install postcss-custom-selector
$ npm install postcss-custom-selectors

## 快速开始

```js
// dependencies
var fs = require('fs')
var postcss = require('postcss')
var selector = require('postcss-custom-selector')
var selector = require('postcss-custom-selectors')

// css to be processed
var css = fs.readFileSync('input.css', 'utf8')

// process css using postcss-custom-selector
// process css using postcss-custom-selectors
var output = postcss()
.use(selector())
.process(css)
Expand Down Expand Up @@ -118,31 +118,50 @@ a:link, a:visited {
### Grunt

```js
grunt.initConfig({
postcss: {
options: {
processors: [require('postcss-custom-selector').postcss]
},
dist: {
src: 'css/*.css'
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
postcss: {
options: {
processors: [
require('autoprefixer-core')({ browsers: ['> 0%'] }).postcss, //Other plugin
require('postcss-custom-selector')(),
]
},
dist: {
src: ['src/*.css'],
dest: 'build/grunt.css'
}
}
}
});
});

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-postcss');

grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', ['postcss']);
}
```

### Gulp

```js
var gulp = require('gulp');
var rename = require('gulp-rename');
var postcss = require('gulp-postcss');

gulp.task('css', function() {
return gulp.src('./src/*.css')
.pipe(postcss([require('postcss-custom-selector')]))
.pipe(gulp.dest('./dest'));
var selector = require('postcss-custom-selector')
var autoprefixer = require('autoprefixer-core')

gulp.task('default', function () {
var processors = [
autoprefixer({ browsers: ['> 0%'] }), //Other plugin
selector()
];
gulp.src('src/*.css')
.pipe(postcss(processors))
.pipe(rename('gulp.css'))
.pipe(gulp.dest('build'))
});
gulp.watch('src/*.css', ['default']);
```


Expand Down Expand Up @@ -186,11 +205,11 @@ section h1, article h1, aside h1, nav h1 {
## 贡献

* 安装相关依赖模块
* 尊重编码风格(安装)
* 尊重编码风格(安装 [EditorConfig](http://editorconfig.org/)
* 运行测试

```
$ git clone https://github.com/postcss/postcss-custom-selector.git
$ git clone https://github.com/postcss/postcss-custom-selectors.git
$ git checkout -b patch
$ npm install
$ npm test
Expand Down

0 comments on commit 2a9c152

Please sign in to comment.