Skip to content

Commit

Permalink
CSS/SASS/LESS sourcemaps (#2489)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic authored and devongovett committed Mar 5, 2019
1 parent f68f0df commit 8deb85d
Show file tree
Hide file tree
Showing 41 changed files with 1,198 additions and 209 deletions.
79 changes: 64 additions & 15 deletions packages/core/integration-tests/test/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ describe('css', function() {
{
name: 'index.css',
assets: ['index.css', 'local.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
}
]
});
Expand All @@ -50,21 +54,30 @@ describe('css', function() {
],
childBundles: [
{
type: 'css',
name: 'index.css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
name: 'index.js.map'
},
{
type: 'js',
assets: ['local.js', 'local.css'],
assets: ['local.css', 'local.js'],
childBundles: [
{
type: 'css',
assets: ['local.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand All @@ -91,7 +104,11 @@ describe('css', function() {
{
name: 'index.css',
assets: ['index.css', 'other.css', 'local.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
name: 'index.js.map',
Expand Down Expand Up @@ -124,7 +141,11 @@ describe('css', function() {
{
name: 'index.css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -179,7 +200,11 @@ describe('css', function() {
{
name: 'index.css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -277,7 +302,11 @@ describe('css', function() {
{
name: 'index.css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -325,7 +354,11 @@ describe('css', function() {
{
name: 'index.css',
assets: ['composes-1.css', 'composes-2.css', 'mixins.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -383,7 +416,11 @@ describe('css', function() {
{
name: 'index2.css',
assets: ['composes-3.css', 'mixins.scss'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -418,7 +455,11 @@ describe('css', function() {
{
name: 'index3.css',
assets: ['composes-4.css', 'mixins.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -458,7 +499,11 @@ describe('css', function() {
{
name: 'index4.css',
assets: ['composes-5.css', 'mixins-intermediate.css', 'mixins.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -496,7 +541,11 @@ describe('css', function() {
{
name: 'index5.css',
assets: ['composes-6.css', 'mixins.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -532,7 +581,7 @@ describe('css', function() {
);
assert(css.includes('.local'));
assert(css.includes('.index'));
assert(!css.includes('\n'));
assert.equal(css.split('\n').length, 2); // sourceMappingURL
});

it('should automatically install postcss plugins with npm if needed', async function() {
Expand Down
6 changes: 5 additions & 1 deletion packages/core/integration-tests/test/glob.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ describe('glob', function() {
{
name: 'index.css',
assets: ['index.css', 'other.css', 'local.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down
36 changes: 28 additions & 8 deletions packages/core/integration-tests/test/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ describe('html', function() {
{
type: 'css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'html',
Expand Down Expand Up @@ -151,7 +155,11 @@ describe('html', function() {
{
type: 'css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -185,7 +193,11 @@ describe('html', function() {
{
type: 'css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down Expand Up @@ -219,9 +231,6 @@ describe('html', function() {
type: 'css',
assets: ['index.css'],
childBundles: [
{
type: 'map'
},
{
type: 'js',
assets: [
Expand All @@ -230,7 +239,14 @@ describe('html', function() {
'css-loader.js',
'hmr-runtime.js'
],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
}
]
}
Expand All @@ -257,7 +273,11 @@ describe('html', function() {
{
type: 'css',
assets: ['index.css'],
childBundles: []
childBundles: [
{
type: 'map'
}
]
},
{
type: 'map'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "./test/library.css";

main {
display: none;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$font-stack: Helvetica, sans-serif;
$primary-color: #333;

body {
font: 100% $font-stack;
color: $primary-color;

div {
background-color: red;
width: 100px;
height: 100px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
main {
font-family: monospace;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

div {
width: 100px;
height: 100px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

@import "./other-style.css";

body {
background-color: red;
}

@import "./another-style.css";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

body {
background-color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@value: 100px * 2;

div {
width: @value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$variable: monospace;

div {
font-family: $variable;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "./other.scss";

body {
color: red;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$variable: #333;

body {
color: $variable;
}
Loading

0 comments on commit 8deb85d

Please sign in to comment.