postcss-grid-fluid
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "postcss-grid-fluid", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A PostCSS plugin to create fluid grids.", | ||
@@ -34,10 +34,11 @@ "keywords": [ | ||
"ava": "^0.14.0", | ||
"babel-cli": "^6.7.5", | ||
"babel-cli": "^6.7.7", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-register": "^6.7.2", | ||
"eslint": "^2.8.0", | ||
"eslint-config-airbnb": "^7.0.0", | ||
"eslint-plugin-jsx-a11y": "^0.6.2", | ||
"eslint-plugin-react": "^4.3.0", | ||
"postcss-cli": "^2.5.1" | ||
"eslint-config-airbnb": "^8.0.0", | ||
"eslint-plugin-import": "^1.6.0", | ||
"eslint-plugin-jsx-a11y": "^1.0.3", | ||
"eslint-plugin-react": "^5.0.1", | ||
"postcss-cli": "^2.5.2" | ||
}, | ||
@@ -44,0 +45,0 @@ "eslintConfig": { |
@@ -1,8 +0,17 @@ | ||
# postcss-grid-fluid [![Build Status][ci-img]][ci] | ||
# postcss-grid-fluid | ||
[![npm version][npm-img]][npm] [![Build Status][ci-img]][ci] [![Dependency Status][dep-img]][dep] | ||
[francoisromain.github.io/postcss-grid-fluid](http://francoisromain.github.io/postcss-grid-fluid) | ||
A [PostCSS] plugin to create fluid grids. | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[ci-img]: https://travis-ci.org/francoisromain/postcss-grid-fluid.svg | ||
[ci]: https://travis-ci.org/francoisromain/postcss-grid-fluid | ||
[github.io]: http://francoisromain.github.io/postcss-grid-fluid | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[ci-img]: https://travis-ci.org/francoisromain/postcss-grid-fluid.svg | ||
[ci]: https://travis-ci.org/francoisromain/postcss-grid-fluid | ||
[npm-img]: https://badge.fury.io/js/postcss-grid-fluid.svg | ||
[npm]: https://badge.fury.io/js/postcss-grid-fluid | ||
[dep-img]: https://david-dm.org/francoisromain/postcss-grid-fluid.svg | ||
[dep]: https://david-dm.org/francoisromain/postcss-grid-fluid | ||
@@ -13,3 +22,3 @@ * * * | ||
Install the [npm module](https://www.npmjs.com/package/postcss-grid-system): | ||
Install the [npm package](https://www.npmjs.com/package/postcss-grid-fluid): | ||
@@ -24,18 +33,4 @@ $ npm install postcss-grid-fluid --save-dev | ||
See [PostCSS usage](https://github.com/postcss/postcss#usage) to setup with Gulp, Grunt, Webpack, npm scripts… | ||
See [PostCSS docs](https://github.com/postcss/postcss#usage) to setup with Gulp, Grunt, Webpack, npm scripts… | ||
##### Example with a [npm script](https://docs.npmjs.com/misc/scripts) and [postcss-cli](https://www.npmjs.com/package/postcss-cli): | ||
$ npm install postcss-cli --save-dev | ||
Add a script to package.json: | ||
``` js | ||
"scripts": { | ||
"build": "postcss -u postcss-grid-fluid -i src/styles.css -o dist/styles.css" | ||
} | ||
``` | ||
$ npm run build | ||
* * * | ||
@@ -50,3 +45,3 @@ | ||
@gf { | ||
width: 1, /* width of one blob */ | ||
width: 1, /* width/total of one blob */ | ||
gutter: 0, /* width of the gutter */ | ||
@@ -68,6 +63,19 @@ display: flex /* float or flex */ | ||
- _gutter_ (optional, default = 0): width of the gutter in `px` or `rem`. | ||
Rows are intended to contain a _blob_. They have a negative right margin. | ||
- _gutter_: width of the gutter in `px` or `rem`. | ||
### Blobs | ||
`gf: blob [width](/[total]) ([gutter]) ([display])` | ||
- _width_: width of the blob. Could be an integer if there is a _total_ or a float smaller than 1. | ||
- _total_ (optional, default = 1): divider of the container width. | ||
- _gutter_ (optional, default = 0): width of the gutter in `px` or `rem`. | ||
- _display_ (optional, default = `flex`): `float` or `flex`. | ||
* * * | ||
## Examples | ||
``` css | ||
@@ -81,11 +89,2 @@ | ||
### Blobs | ||
`gf: blob [width](/[total]) ([gutter]) ([display])` | ||
- _width_: width of the blob. Could be an integer if there is a _total_ or an float. | ||
- _total_ (optional): divider of the container width. | ||
- _gutter_: width of the gutter in `px` or `rem`. | ||
- _display_: `float` or `flex`. | ||
``` css | ||
@@ -102,1 +101,5 @@ | ||
``` | ||
01: [input](https://github.com/francoisromain/postcss-button/blob/gh-pages/test/src/01.css), [output](https://github.com/francoisromain/postcss-button/blob/gh-pages/test/dist/01.css), [markup](https://github.com/francoisromain/postcss-button/blob/gh-pages/test/01.html), [demo](http://localhost/francoisromain.github.io/postcss-button/test/01.html) | ||
02: [input](https://githubcom/francoisromain/postcss-button/blob/gh-pages/test/src/02.css), [output](https://github.comfrancoisromain/postcss-button/blob/gh-pages/test/dist/02.css), [markup](https://ithub.com/francoisromain/postcss-button/blob/gh-pages/test/02.html), [demo](http://localhost/francoisromain.github.io/postcss-button/test/02.html) |
@@ -12,11 +12,7 @@ import postcss from 'postcss'; | ||
for (const i in options) { | ||
if (opts && opts.hasOwnProperty(i) && options.hasOwnProperty(i)) { | ||
options[i] = opts[i]; | ||
} | ||
} | ||
Object.assign(options, opts); | ||
return (css) => { | ||
css.walk((node) => { | ||
if (node.type === 'atrule' && node.name.match(/^gf/)) { | ||
if (node.type === 'atrule' && node.name.match(/^gf$/)) { | ||
node.walkDecls((decl) => { | ||
@@ -30,4 +26,4 @@ if (decl.prop.match(/^gutter/) || | ||
node.remove(); | ||
} else if (node.type === 'decl' && node.prop.match(/^gf/)) { | ||
const value = node.value.split(' '); | ||
} else if (node.type === 'decl' && node.prop.match(/^gf$/)) { | ||
const value = node.value.split(/\s+(?![^\[]*\]|[^(]*\)|[^\{]*})/); | ||
if (value[0] === 'row') { | ||
@@ -34,0 +30,0 @@ value[1] = value[1] || options.gutter; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99
12738
10
12
187