-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It runs the PostCSS processor with the autoprefixer and postcss-nested plugins on Bootstrap, Foundation, and Angular Material. Closes #18.
- Loading branch information
1 parent
c891603
commit 8f7edb6
Showing
12 changed files
with
33,039 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,10 @@ | |
"git add" | ||
] | ||
}, | ||
"browserslist": [ | ||
"Chrome 50", | ||
"Firefox 50" | ||
], | ||
"author": { | ||
"name": "Benedikt Meurer", | ||
"email": "[email protected]", | ||
|
@@ -36,6 +40,7 @@ | |
"dependencies": { | ||
"@babel/standalone": "7.0.0-beta.32", | ||
"acorn": "5.5.3", | ||
"autoprefixer": "8.2.0", | ||
"babylon": "7.0.0-beta.32", | ||
"benchmark": "^2.1.4", | ||
"buble": "0.19.3", | ||
|
@@ -46,6 +51,8 @@ | |
"esprima": "4.0.0", | ||
"jshint": "2.9.5", | ||
"lebab": "2.7.7", | ||
"postcss": "6.0.21", | ||
"postcss-nested": "3.0.0", | ||
"prepack": "0.2.25", | ||
"prettier": "1.9.2", | ||
"source-map": "0.6.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2018 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module.exports = ` | ||
.phone { | ||
&_title { | ||
width: 500px; | ||
@media (max-width: 500px) { | ||
width: auto; | ||
} | ||
body.is_dark & { | ||
color: white; | ||
} | ||
} | ||
img { | ||
display: block; | ||
} | ||
}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2018 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
const fs = require("fs"); | ||
const postcss = require("postcss"); | ||
const nested = require("postcss-nested"); | ||
const autoprefixer = require("autoprefixer"); | ||
|
||
const nestedRules = require("./mocks/nested-rules"); | ||
|
||
const cleaner = postcss([autoprefixer({ add: false, browsers: [] })]); | ||
const processor = postcss([autoprefixer, nested]); | ||
|
||
const payloads = [ | ||
{ | ||
name: "bootstrap-4.0.0.css", | ||
options: { from: `third_party/${this.name}`, map: false } | ||
}, | ||
{ | ||
name: "foundation-6.4.2.css", | ||
options: { from: `third_party/${this.name}`, map: false } | ||
}, | ||
{ | ||
name: "angular-material-1.1.8.css", | ||
options: { from: `third_party/${this.name}`, map: false } | ||
} | ||
].map(({ name, options }) => { | ||
// Clean prefixes. | ||
const source = fs.readFileSync(`third_party/${name}`, "utf8"); | ||
// Add some nested rules. | ||
const css = cleaner.process(source).css + nestedRules; | ||
|
||
return { | ||
payload: css, | ||
options | ||
}; | ||
}); | ||
|
||
module.exports = { | ||
name: "postcss", | ||
fn() { | ||
return payloads.map( | ||
({ payload, options }) => processor.process(payload, options).css | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2018 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
const postcssBenchmark = require("./postcss-benchmark"); | ||
|
||
it("postcss-benchmark runs to completion", () => void postcssBenchmark.fn()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.