postcss-grid-system
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -23,3 +23,3 @@ 'use strict'; | ||
blocWidth[i] = _postcss2.default.rule(); | ||
var blocWidthValue = opts.unit * i - opts.gutter; | ||
var blocWidthValue = opts.width * i - opts.gutter; | ||
if (opts.display === 'flex') { | ||
@@ -26,0 +26,0 @@ blocWidth[i].append({ prop: 'flex', value: '0 1 ' + blocWidthValue + 'rem' }); |
@@ -20,3 +20,3 @@ 'use strict'; | ||
var containerQuery = _postcss2.default.rule(); | ||
var containerWidth = breakpoint * opts.unit - opts.gutter + 2 * opts.padding; | ||
var containerWidth = breakpoint * opts.width - opts.gutter + 2 * opts.padding; | ||
@@ -23,0 +23,0 @@ for (var i = 0; i <= breakpoint; i++) { |
@@ -11,6 +11,2 @@ 'use strict'; | ||
var _utils = require('./utils'); | ||
var _utils2 = _interopRequireDefault(_utils); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -27,3 +23,3 @@ | ||
var fraction = _postcss2.default.rule(); | ||
var fractionValue = opts.unit * ratio / total - opts.gutter; | ||
var fractionValue = opts.width * ratio / total - opts.gutter; | ||
@@ -30,0 +26,0 @@ fraction.selectors = fractionSelectors; |
@@ -73,3 +73,3 @@ 'use strict'; | ||
for (var breakpoint = opts.min; breakpoint <= opts.max; breakpoint++) { | ||
var queryWidth = breakpoint * opts.unit - opts.gutter + 2 * opts.padding + scrollbarsWidth; | ||
var queryWidth = breakpoint * opts.width - opts.gutter + 2 * opts.padding + scrollbarsWidth; | ||
var mediaQuery = _postcss2.default.atRule({ name: 'media', params: '(min-width: ' + queryWidth + 'rem)' }); | ||
@@ -76,0 +76,0 @@ |
@@ -21,3 +21,3 @@ 'use strict'; | ||
var opts = { | ||
unit: 20.5, | ||
width: 20.5, | ||
gutter: 1.5, | ||
@@ -44,3 +44,2 @@ padding: 1.5, | ||
node.walkDecls(function (decl) { | ||
if (decl.prop.match(/^gs/)) { | ||
@@ -95,3 +94,3 @@ var value = decl.value.split(' '); | ||
gsAtRule.walkDecls(function (decl) { | ||
if (decl.prop.match(/^unit/) || decl.prop.match(/^gutter/) || decl.prop.match(/^padding/) || decl.prop.match(/^max/) || decl.prop.match(/^min/)) { | ||
if (decl.prop.match(/^width/) || decl.prop.match(/^gutter/) || decl.prop.match(/^padding/) || decl.prop.match(/^max/) || decl.prop.match(/^min/)) { | ||
opts[decl.prop] = parseFloat(decl.value, 10); | ||
@@ -122,84 +121,2 @@ } else if (decl.prop.match(/^align/) || decl.prop.match(/^display/)) { | ||
}; | ||
}); | ||
/* | ||
bloc-units-width | ||
------------------------------- | ||
size 1 2 3 4 5 | ||
----------------------------------------------------------------------------- | ||
breakpoint 1 | ||
width 1 1 to 7 - - - - | ||
breakpoint 2 | ||
width 1 (1) 2 to 7 - - - | ||
width 2 1 2 to 7 - - - | ||
breakpoint 3 | ||
width 1 (1) (2) 3 to 7 - - | ||
width 2 (1) (2) 3 to 7 - - | ||
width 3 1 2 3 to 7 - - | ||
breakpoint = 4 | ||
width 1 (1) (2) (3) 4 to 7 - | ||
width 2 (1) (2) (3) 4 to 7 - | ||
width 3 (1) (2) (3) 4 to 7 - | ||
width 4 1 2 3 4 to 7 - | ||
etc. | ||
*/ | ||
/* | ||
bloc-units-width-offset | ||
------------------------------ | ||
size 1 2 3 4 5 | ||
----------------------------------------------------------------------------- | ||
breakpoint 1 | ||
2-1 > 2-6 - - - - | ||
3-1 > 3-5 - - - - | ||
4-1 > 4-4 - - - - | ||
5-1 > 5-3 - - - - | ||
etc. | ||
breakpoint 2 | ||
(2-1 > 2-6) - - - - | ||
(3-1 > 3-5) - - - - | ||
(4-1 > 4-4) - - - - | ||
(5-1 > 5-3) - - - - | ||
etc. | ||
breakpoint 3 | ||
(2-2 > 2-6) 2-1 - - - | ||
(3-2 > 3-5) 3-1 - - - | ||
(4-2 > 4-4) 4-1 - - - | ||
(5-2 > 5-3) 5-1 - - - | ||
(6-2) 6-1 - - - | ||
- 7-1 - - - | ||
breakpoint 4 | ||
(2-3 > 2-6) 2-2 (2-1) - - - | ||
(3-3 > 3-5) 3-2 3-1 - - | ||
(4-3 > 4-4) 4-2 4-1 - - | ||
(5-3) 5-2 5-1 - - | ||
- 6-2 6-1 - - | ||
- - 7-1 - - | ||
breakpoint 5 | ||
(2-4 > 2-6) 2-3 (2-1 > 2-2) - - - | ||
(3-4 > 3-5) 3-3 3-2 (3-1) - - | ||
(4-4) 4-3 4-2 4-1 - | ||
- 5-3 5-2 5-1 - | ||
- - 6-2 6-1 - | ||
- - - 7-1 | ||
breakpoint 6 | ||
(2-5 > 2-6) 2-4 (2-1 > 2-3) - - - | ||
(3-5) 3-4 3-3 (3-2 > 3-1) - - | ||
- 4-4 4-3 4-2 (4-1) - | ||
- 5-4 5-3 5-2 5-1 | ||
- - - 6-2 6-1 | ||
- - - - 7-1 | ||
etc. | ||
*/ | ||
}); |
{ | ||
"name": "postcss-grid-system", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A PostCSS plugin to create grids based on a fixed column width.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -25,18 +25,4 @@ # postcss-grid-system [![Build Status][ci-img]][ci] | ||
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-system -i src/styles.css -o dist/styles.css" | ||
} | ||
``` | ||
$ npm run build | ||
* * * | ||
@@ -87,3 +73,3 @@ | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/00.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/00.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/00.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/00.html) | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/00.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/00.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/00.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/00.html) | ||
@@ -104,3 +90,3 @@ ### Containers | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/01.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/01.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/01.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/01.html) | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/01.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/01.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/01.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/01.html) | ||
@@ -121,3 +107,3 @@ ### Rows | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/02.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/02.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/02.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/02.html) | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/02.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/02.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/02.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/02.html) | ||
@@ -145,5 +131,5 @@ ### Blocs | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/03.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/03.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/03.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/03.html) | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/03.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/03.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/03.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/03.html) | ||
Example (with offset): [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/04.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/04.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/04.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/04.html) | ||
Example (with offset): [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/04.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/04.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/04.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/04.html) | ||
@@ -165,3 +151,3 @@ ### Fractions | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/05.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/05.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/05.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/05.html) | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/05.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/05.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/05.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/05.html) | ||
@@ -188,5 +174,5 @@ | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/06.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/06.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/06.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/06.html) | ||
Example: [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/06.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/06.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/06.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/06.html) | ||
Example (with offset): [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/07.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/07.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/07.html), [demo](http://localhost/francoisromain.github.io/postcss-grid-system/test/07.html) | ||
Example (with offset): [input](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/src/07.css), [output](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/dist/07.css), [markup](https://github.com/francoisromain/postcss-grid-system/blob/gh-pages/test/07.html), [demo](http://francoisromain.github.io/postcss-grid-system/test/07.html) | ||
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
40454
1220
172