Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: luisrudge/postcss-flexbugs-fixes
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a9b3148da81066f80e74abd5bc98dcf2f1ab2366
Choose a base ref
...
head repository: luisrudge/postcss-flexbugs-fixes
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ff3e5a203a3e95094f4898be46c4f9130b8e948e
Choose a head ref
  • 2 commits
  • 8 files changed
  • 2 contributors

Commits on Apr 27, 2020

  1. fix calc regex (#69)

    luisrudge authored Apr 27, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5eb09c7 View commit details

Commits on Oct 31, 2020

  1. Port to PostCSS 8 API. (#71)

    * Port to PostCSS 8 API.
    
    * 5.0.0
    
    Co-authored-by: Luis Rudge <luis@luisrudge.net>
    ludofischer and luisrudge authored Oct 31, 2020
    Copy the full SHA
    ff3e5a2 View commit details
Showing with 88 additions and 277 deletions.
  1. +1 −1 .travis.yml
  2. +6 −0 CHANGELOG.md
  3. +1 −1 bugs/bug81a.js
  4. +29 −25 index.js
  5. +3 −5 package.json
  6. +9 −0 specs/regressiveSpecs.js
  7. +1 −1 specs/test.js
  8. +38 −244 yarn.lock
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sudo: false
language: node_js
node_js:
- 10
- 14
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 5.0.0
* upgrade to postcss 8 [#71](https://github.com/luisrudge/postcss-flexbugs-fixes/pull/71)

## 4.2.1
* Fix `calc` regex [#69](https://github.com/luisrudge/postcss-flexbugs-fixes/pull/69)

## 4.2.0
* Don't change values that reference custom props [#64](https://github.com/luisrudge/postcss-flexbugs-fixes/pull/64)

2 changes: 1 addition & 1 deletion bugs/bug81a.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var postcss = require('postcss');

module.exports = function(decl) {
var regex = /(\d{1,}) (\d{1,}) (calc\(.*?\))/g;
var regex = /(\d{1,}) (\d{1,}) (calc\(.*\))/g;
var matches = regex.exec(decl.value);
if (decl.prop === 'flex' && matches) {
var grow = postcss.decl({
54 changes: 29 additions & 25 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var postcss = require('postcss');
var bug4 = require('./bugs/bug4');
var bug6 = require('./bugs/bug6');
var bug81a = require('./bugs/bug81a');
@@ -12,30 +11,35 @@ var doNothingValues = [
'unset'
];

module.exports = postcss.plugin('postcss-flexbugs-fixes', function(opts) {
module.exports = function(opts) {
var options = Object.assign({ bug4: true, bug6: true, bug81a: true }, opts);

return function(css) {
css.walkDecls(function(d) {
if (d.value.indexOf('var(') > -1) {
return;
}
if (d.value === 'none') {
return;
}
var values = postcss.list.space(d.value);
if (doNothingValues.indexOf(d.value) > 0 && values.length === 1) {
return;
}
if (options.bug4) {
bug4(d);
}
if (options.bug6) {
bug6(d);
}
if (options.bug81a) {
bug81a(d);
}
});
return {
postcssPlugin: 'postcss-flexbugs-fixes',
Once: function(css, postcss) {
css.walkDecls(function(d) {
if (d.value.indexOf('var(') > -1) {
return;
}
if (d.value === 'none') {
return;
}
var values = postcss.list.space(d.value);
if (doNothingValues.indexOf(d.value) > 0 && values.length === 1) {
return;
}
if (options.bug4) {
bug4(d);
}
if (options.bug6) {
bug6(d);
}
if (options.bug81a) {
bug81a(d);
}
})
}
};
});
};

module.exports.postcss = true;
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-flexbugs-fixes",
"version": "4.2.0",
"version": "5.0.0",
"description": "PostCSS plugin This project tries to fix all of flexbug's issues",
"keywords": [
"postcss",
@@ -15,16 +15,14 @@
"repository": {
"type": "git",
"url": "https://github.com/luisrudge/postcss-flexbugs-fixes.git"
},
"dependencies": {
"postcss": "^7.0.26"
},
},
"main": "index.js",
"files": [
"bugs",
"index.js"
],
"devDependencies": {
"postcss": "^8.1.4",
"chai": "^4.2.0",
"gulp": "^4.0.2",
"gulp-eslint": "^6.0.0",
9 changes: 9 additions & 0 deletions specs/regressiveSpecs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var test = require('./test');

describe('regressive tests', function () {
it('https://github.com/luisrudge/postcss-flexbugs-fixes/issues/68', function (done) {
var input = 'div{flex: 1 0 calc(30% - (30px / 3));}';
var output = 'div{flex-grow: 1;flex-shrink: 0;flex-basis: calc(30% - (30px / 3));}';
test(input, output, {}, done);
});
});
2 changes: 1 addition & 1 deletion specs/test.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ var plugin = require('../');

module.exports = function(input, output, opts, done) {
postcss([plugin(opts)])
.process(input)
.process(input, {from: undefined})
.then(function(result) {
expect(result.css).to.eql(output);
expect(result.warnings()).to.be.empty;
Loading