Skip to content

Commit

Permalink
Fix external CSS imports (facebook#2680)
Browse files Browse the repository at this point in the history
* Fix external CSS imports

* Add external CSS import to integration test

* Fix assertion
  • Loading branch information
gaearon authored and morgs32 committed Sep 1, 2017
1 parent 0ecd3fc commit e696979
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ module.exports = {
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
Expand Down
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ module.exports = {
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"chai": "3.5.0",
"jsdom": "9.8.3",
"mocha": "3.2.0",
"normalize.css": "7.0.0",
"prop-types": "15.5.6",
"test-integrity": "1.0.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ describe('Integration', () => {

expect(
doc.getElementsByTagName('style')[0].textContent.replace(/\s/g, '')
).to.match(/html\{/);
expect(
doc.getElementsByTagName('style')[1].textContent.replace(/\s/g, '')
).to.match(/#feature-css-inclusion\{background:.+;color:.+}/);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Ensure CSS inclusion doesn't regress
* https://github.com/facebookincubator/create-react-app/issues/2677
*/
@import '~normalize.css/normalize.css';

#feature-css-inclusion {
background: palevioletred;
color: papayawhip;
Expand Down

0 comments on commit e696979

Please sign in to comment.