Skip to content

Commit 322293c

Browse files
committed
Add support for scss, sass, and less
1 parent 604107d commit 322293c

38 files changed

+2004
-96
lines changed

__tests__/css-entry-array.test.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const webpack = require('webpack');
22
const path = require('path');
33
const rimraf = require('rimraf');
44
const options = require('./fixtures/css-array-entry/webpack.config.js');
5+
const optionsSass = require('./fixtures/css-array-entry/webpack.config.sass');
6+
const optionsLess = require('./fixtures/css-array-entry/webpack.config.less');
57
const dirPath = path.join(__dirname, './fixtures/css-array-entry/dir');
68
const fileShouldNotExist = require('./utils/file-should-not-exist.js');
79

@@ -28,4 +30,38 @@ describe('Array of CSS Dependencies as Entry', () => {
2830
done();
2931
});
3032
});
33+
34+
it('JS entry should not exist w/ sass', done => {
35+
webpack(optionsSass, () => {
36+
fileShouldNotExist(dirPath, '/s.js');
37+
done();
38+
});
39+
});
40+
41+
it('JS entry source map should not exist w/ sass', done => {
42+
const optionSourceMap = Object.assign({}, options);
43+
optionSourceMap.devtool = 'source-map';
44+
45+
webpack(optionSourceMap, () => {
46+
fileShouldNotExist(dirPath, '/s.js.map');
47+
done();
48+
});
49+
});
50+
51+
it('JS entry should not exist w/ less', done => {
52+
webpack(optionsLess, () => {
53+
fileShouldNotExist(dirPath, '/l.js');
54+
done();
55+
});
56+
});
57+
58+
it('JS entry source map should not exist w/ less', done => {
59+
const optionSourceMap = Object.assign({}, optionsLess);
60+
optionSourceMap.devtool = 'source-map';
61+
62+
webpack(optionSourceMap, () => {
63+
fileShouldNotExist(dirPath, '/l.js.map');
64+
done();
65+
});
66+
});
3167
});

__tests__/fixtures/css-array-entry/dir/a.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

__tests__/fixtures/css-array-entry/dir/a.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

__tests__/fixtures/css-array-entry/dir/l.css

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

__tests__/fixtures/css-array-entry/dir/l.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@nice-blue: #5B83AD;
2+
@light-blue: @nice-blue + #111;
3+
4+
#header {
5+
color: @light-blue;
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$font-stack: Helvetica, sans-serif
2+
$primary-color: #333
3+
4+
body
5+
font: 100% $font-stack
6+
color: $primary-color
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@nice-yellow: yellow;
2+
3+
.duck {
4+
color: @nice-yellow;
5+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$font-stack: Helvetica, sans-serif;
2+
$primary-color: #333;
3+
4+
body {
5+
font: 100% $font-stack;
6+
color: $primary-color;
7+
}
8+
9+
.green {
10+
color : green;
11+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2+
const OmitJSforCSSPlugin = require('../../../src/index.js');
3+
const path = require('path');
4+
5+
module.exports = {
6+
entry: {
7+
l: [path.join(__dirname, 'one.less'), path.join(__dirname, 'two.less')]
8+
},
9+
output: {
10+
filename: '[name].js',
11+
path: path.join(__dirname, '/dir')
12+
},
13+
module: {
14+
rules: [
15+
{
16+
test: /\.(less)$/,
17+
use: [
18+
MiniCssExtractPlugin.loader,
19+
'css-loader',
20+
'less-loader'
21+
]
22+
}
23+
]
24+
},
25+
mode: 'development',
26+
plugins: [new MiniCssExtractPlugin({ filename: '[name].css' }), new OmitJSforCSSPlugin()],
27+
stats: 'none'
28+
};

0 commit comments

Comments
 (0)