Skip to content

Commit

Permalink
fix: don't mess with values that reference custom props (#64)
Browse files Browse the repository at this point in the history
* fix: don't mess with values that reference custom props

* node 8 is EOL
  • Loading branch information
jquense committed Feb 4, 2020
1 parent c51f4e7 commit 04e66ac
Show file tree
Hide file tree
Showing 8 changed files with 1,762 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,4 +1,4 @@
sudo: false
language: node_js
node_js:
- 8.11.1
- 10
11 changes: 6 additions & 5 deletions gulpfile.js
@@ -1,16 +1,17 @@
var gulp = require('gulp');

gulp.task('lint', function () {
function lint() {
var eslint = require('gulp-eslint');
return gulp.src(['index.js', 'bugs/*.js', 'specs/*.js', 'gulpfile.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
}

gulp.task('test', function () {
function test() {
var mocha = require('gulp-mocha');
return gulp.src('specs/*.js', { read: false }).pipe(mocha());
});
}

exports.default = gulp.series(lint, test);

gulp.task('default', ['lint', 'test']);
3 changes: 3 additions & 0 deletions index.js
Expand Up @@ -10,6 +10,9 @@ module.exports = postcss.plugin('postcss-flexbugs-fixes', function (opts) {

return function (css) {
css.walkDecls(function (d) {
if (d.value.indexOf('var(') > -1) {

This comment has been minimized.

Copy link
@alexander-akait

alexander-akait Feb 4, 2020

Contributor

@jquense I think we should avoid env( too

This comment has been minimized.

Copy link
@jquense

jquense Feb 4, 2020

Author Contributor

huh TIL about env()

This comment has been minimized.

Copy link
@alexander-akait

alexander-akait Feb 4, 2020

Contributor

Can you send a PR?

This comment has been minimized.

Copy link
@jquense

jquense Feb 4, 2020

Author Contributor

honestly, probably not, short on time right now

return;
}
if (d.value === 'none') {
return;
}
Expand Down
19 changes: 13 additions & 6 deletions package.json
Expand Up @@ -2,26 +2,33 @@
"name": "postcss-flexbugs-fixes",
"version": "4.1.0",
"description": "PostCSS plugin This project tries to fix all of flexbug's issues",
"keywords": ["postcss", "css", "postcss-plugin", "flexbugs", "flexbox", "flex"],
"keywords": [
"postcss",
"css",
"postcss-plugin",
"flexbugs",
"flexbox",
"flex"
],
"author": "Luis Rudge <luis@luisrudge.net>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/luisrudge/postcss-flexbugs-fixes.git"
"url": "https://github.com/luisrudge/postcss-flexbugs-fixes.git"
},
"dependencies": {
"postcss": "^7.0.0"
"postcss": "^7.0.26"
},
"main": "index.js",
"files": [
"bugs",
"index.js"
],
"devDependencies": {
"chai": "^4.2.0",
"gulp": "^4.0.0",
"gulp-eslint": "^0.12.0",
"gulp-mocha": "^2.0.1",
"chai": "^2.3.0",
"gulp": "^3.8.11"
"gulp-mocha": "^7.0.2"
},
"scripts": {
"test": "gulp"
Expand Down
5 changes: 5 additions & 0 deletions specs/bug4Spec.js
Expand Up @@ -56,6 +56,11 @@ describe('bug 4', function() {
test(input, input, {}, done);
});
});

it('is a custom property', function(done) {
var input = 'div{flex: var(--foo);}';
test(input, input, {}, done);
});
});
});
});
6 changes: 6 additions & 0 deletions specs/bug6Spec.js
Expand Up @@ -33,6 +33,12 @@ describe('bug 6', function() {
test(input, input, {}, done);
});
});

it('is a custom property', function(done) {
var input = 'div{flex: var(--foo);}';
test(input, input, {}, done);
});
});

});
});
5 changes: 5 additions & 0 deletions specs/bug81aSpec.js
Expand Up @@ -29,6 +29,11 @@ describe('bug 8.1.a', function() {
test(input, input, {}, done);
});
});

it('is a custom property', function(done) {
var input = 'div{flex: var(--foo);}';
test(input, input, {}, done);
});
});
});
});

0 comments on commit 04e66ac

Please sign in to comment.