postcss-grid-system
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -21,8 +21,13 @@ 'use strict'; | ||
var blocWidth = {}; | ||
var blocLeft = {}; | ||
var blocRight = {}; | ||
var blocWidthFill = function blocWidthFill(unit, width) { | ||
if (blocs[unit] && blocs[unit][width] && blocs[unit][width][1]) { | ||
_utils2.default.selectorsAdd(blocWidth[width], blocs[unit][width][1]); | ||
_utils2.default.selectorsAdd(blocLeft[width], blocs[unit][width][1]); | ||
} | ||
if (blocs[unit] && blocs[unit][width] && blocs[unit][width][0]) { | ||
_utils2.default.selectorsAdd(blocWidth[width], blocs[unit][width][0]); | ||
_utils2.default.selectorsAdd(blocRight[width], blocs[unit][width][0]); | ||
} | ||
@@ -32,8 +37,16 @@ }; | ||
for (var width = 1; width <= breakpoint; width++) { | ||
blocLeft[width] = _postcss2.default.rule(); | ||
blocRight[width] = _postcss2.default.rule(); | ||
blocWidth[width] = _postcss2.default.rule(); | ||
var blocWidthValue = opts.width * width - opts.gutter; | ||
if (opts.display === 'flex') { | ||
if (opts.display === 'float') { | ||
blocLeft[width].append({ prop: 'float', value: 'left' }); | ||
blocLeft[width].append({ prop: 'clear', value: 'none' }); | ||
blocRight[width].append({ prop: 'float', value: 'right' }); | ||
blocRight[width].append({ prop: 'clear', value: 'none' }); | ||
blocWidth[width].append({ prop: 'width', value: blocWidthValue + 'rem' }); | ||
} else { | ||
blocRight[width].append({ prop: 'margin-left', value: 'auto' }); | ||
blocWidth[width].append({ prop: 'flex', value: '0 1 ' + blocWidthValue + 'rem' }); | ||
} else if (opts.display === 'float') { | ||
blocWidth[width].append({ prop: 'width', value: blocWidthValue + 'rem' }); | ||
} | ||
@@ -43,8 +56,8 @@ } | ||
for (var unit = 0; unit <= opts.max; unit++) { | ||
if (unit === breakpoint) { | ||
if (unit < breakpoint) { | ||
blocWidthFill(unit, breakpoint); | ||
} else if (unit === breakpoint) { | ||
for (var _width = 0; _width <= breakpoint; _width++) { | ||
blocWidthFill(unit, _width); | ||
} | ||
} else if (unit < breakpoint) { | ||
blocWidthFill(unit, breakpoint); | ||
} | ||
@@ -57,2 +70,10 @@ } | ||
} | ||
if (blocRight[_width2].selector && blocRight[_width2].nodes.length) { | ||
node.append(blocRight[_width2]); | ||
} | ||
if (blocLeft[_width2].selector && blocLeft[_width2].nodes.length) { | ||
node.append(blocLeft[_width2]); | ||
} | ||
} | ||
@@ -59,0 +80,0 @@ })(); |
@@ -43,6 +43,2 @@ 'use strict'; | ||
var _blocsAlignQuery = require('./blocs-align-query'); | ||
var _blocsAlignQuery2 = _interopRequireDefault(_blocsAlignQuery); | ||
var _columnsQuery = require('./columns-query'); | ||
@@ -75,3 +71,2 @@ | ||
(0, _blocsAlignQuery2.default)(e.blocs, mediaQuery, opts, breakpoint); | ||
(0, _blocsQuery2.default)(e.blocs, mediaQuery, opts, breakpoint); | ||
@@ -78,0 +73,0 @@ |
{ | ||
"name": "postcss-grid-system", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A PostCSS plugin to create grids based on a fixed column width.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
28973
524