Skip to content

Commit

Permalink
Add Stylis
Browse files Browse the repository at this point in the history
  • Loading branch information
thysultan committed May 29, 2017
1 parent 1c2bbd3 commit b7b64f2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"stylecow-plugin-prefixes": "^6.0.5",
"stylecow-plugin-variables": "^5.1.1",
"stylus": "^0.54.5",
"through2": "^2.0.3"
"through2": "^2.0.3",
"stylis": "^3.0.5"
},
"scripts": {
"lint-staged": "lint-staged",
Expand Down
7 changes: 7 additions & 0 deletions parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var gonzales = require('gonzales');
var parserlib = require('parserlib');
var gonzalesPe = require('gonzales-pe');
var csstree = require('css-tree');
var stylis = require('stylis');

module.exports = {
name: 'Bootstrap',
Expand Down Expand Up @@ -105,6 +106,12 @@ module.exports = {
fn: function () {
stylecow.parse(css).toString();
}
},
{
name: 'Stylis',
fn: function () {
stylis('', css)
}
}
]
};
Expand Down
11 changes: 11 additions & 0 deletions prefixers.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ var scss = '@import \'compass/css3\';\n' + css
var scssFile = path.join(__dirname, 'cache/bootstrap.prefixers.scss');
fs.writeFileSync(scssFile, scss);

// Stylis
var stylis = require('stylis')

module.exports = {
name: 'Bootstrap',
maxTime: 15,
Expand Down Expand Up @@ -90,6 +93,14 @@ module.exports = {
done.resolve();
});
}
},
{
name: 'Stylis',
defer: true,
fn: function (done) {
stylis('', css);
done.resolve();
}
}
]
};
Expand Down
17 changes: 17 additions & 0 deletions preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ for ( i = 0; i < 100; i++ ) {
lcss += '.search { fill: black; .icon() }';
}

// Stylis
var stylis = require('stylis');
var styi = css;
styi += ':root { --size: 100px; }';
for ( i = 0; i < 100; i++ ) {
styi += 'body h1 a { color: black; }';
styi += 'h2 { width: var(--size); }';
styi += 'h1 { width: calc(2 * var(--size)); }';
styi += '.search { fill: black; width: 16px; height: 16px; }';
}

module.exports = {
name: 'Bootstrap',
maxTime: 15,
Expand Down Expand Up @@ -170,6 +181,12 @@ module.exports = {
done.resolve();
});
}
},
{
name: 'Stylis',
fn: function () {
stylis('', styi);
}
}
]
};
Expand Down

0 comments on commit b7b64f2

Please sign in to comment.