-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
6,043 additions
and
6,369 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1 @@ | ||
body { | ||
color: red; | ||
} | ||
a { | ||
color: blue; | ||
} | ||
body{color:red}a{color:blue} |
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 |
---|---|---|
@@ -1,7 +1 @@ | ||
body { | ||
margin: 0; | ||
color: red; | ||
} | ||
p { | ||
margin: 1000px; | ||
} | ||
body{margin:0;color:red}p{margin:1000px} |
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 |
---|---|---|
@@ -1,9 +1 @@ | ||
body { | ||
color: red; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
p { | ||
padding: 500px; | ||
padding: 1000px; | ||
} | ||
body{color:red;padding:0;margin:0}p{padding:500px;padding:1000px} |
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 |
---|---|---|
@@ -1,6 +1 @@ | ||
body { | ||
color: red; | ||
} | ||
a { | ||
color: blue; | ||
} | ||
body{color:red}a{color:blue} |
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 |
---|---|---|
@@ -1,6 +1 @@ | ||
body { | ||
color: red; | ||
} | ||
p { | ||
color: green; | ||
} | ||
body{color:red}p{color:green} |
19 changes: 8 additions & 11 deletions
19
test/cases/duplicate-css-exists-without-plugin/webpack.config.js
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 |
---|---|---|
@@ -1,23 +1,20 @@ | ||
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | ||
import OptimizeCssAssetsPlugin from '../../../src/'; | ||
import ExtractTextPlugin from "extract-text-webpack-plugin"; | ||
import OptimizeCssAssetsPlugin from "../../../src/"; | ||
|
||
module.exports = { | ||
entry: './index', | ||
entry: "./index", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: { loader: 'style-loader' }, | ||
fallback: { loader: "style-loader" }, | ||
use: { | ||
loader: 'css-loader', | ||
options: { minimize: true } | ||
loader: "css-loader" | ||
} | ||
}) | ||
}, | ||
], | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new ExtractTextPlugin('file.css') | ||
], | ||
plugins: [new ExtractTextPlugin("file.css")] | ||
}; |
2 changes: 1 addition & 1 deletion
2
test/cases/only-assetNameRegExp-processed/expected/optimize.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 |
---|---|---|
@@ -1 +1 @@ | ||
a{color:#00f}body{color:red;margin:0}p{margin:1000px} | ||
a{color:#00f}body{margin:0;color:red}p{margin:1000px} |
24 changes: 11 additions & 13 deletions
24
test/cases/only-assetNameRegExp-processed/webpack.config.js
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 |
---|---|---|
@@ -1,40 +1,38 @@ | ||
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | ||
import OptimizeCssAssetsPlugin from '../../../src/'; | ||
import ExtractTextPlugin from "extract-text-webpack-plugin"; | ||
import OptimizeCssAssetsPlugin from "../../../src/"; | ||
|
||
const notToProcess = new ExtractTextPlugin('as_is.css'); | ||
const toProcess = new ExtractTextPlugin('optimize.css'); | ||
const notToProcess = new ExtractTextPlugin("as_is.css"); | ||
const toProcess = new ExtractTextPlugin("optimize.css"); | ||
|
||
module.exports = { | ||
entry: './index', | ||
entry: "./index", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /as-is\.css$/, | ||
use: notToProcess.extract({ | ||
fallback: { loader: 'style-loader' }, | ||
fallback: { loader: "style-loader" }, | ||
use: { | ||
loader: 'css-loader', | ||
options: { minimize: false } | ||
loader: "css-loader" | ||
} | ||
}) | ||
}, | ||
{ | ||
test: /optimize-me\.css$/, | ||
use: toProcess.extract({ | ||
fallback: { loader: 'style-loader' }, | ||
fallback: { loader: "style-loader" }, | ||
use: { | ||
loader: 'css-loader', | ||
options: { minimize: false } | ||
loader: "css-loader" | ||
} | ||
}) | ||
} | ||
], | ||
] | ||
}, | ||
plugins: [ | ||
notToProcess, | ||
toProcess, | ||
new OptimizeCssAssetsPlugin({ | ||
assetNameRegExp: /optimize\.css/g | ||
}) | ||
], | ||
] | ||
}; |
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 |
---|---|---|
@@ -1,24 +1,20 @@ | ||
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | ||
import OptimizeCssAssetsPlugin from '../../../src/'; | ||
import ExtractTextPlugin from "extract-text-webpack-plugin"; | ||
import OptimizeCssAssetsPlugin from "../../../src/"; | ||
|
||
module.exports = { | ||
entry: './index', | ||
entry: "./index", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: { loader: 'style-loader' }, | ||
fallback: { loader: "style-loader" }, | ||
use: { | ||
loader: 'css-loader', | ||
options: { minimize: true } | ||
loader: "css-loader" | ||
} | ||
}) | ||
}, | ||
], | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new ExtractTextPlugin('file.css'), | ||
new OptimizeCssAssetsPlugin() | ||
], | ||
plugins: [new ExtractTextPlugin("file.css"), new OptimizeCssAssetsPlugin()] | ||
}; |
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 |
---|---|---|
@@ -1,40 +1,39 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import ExtractTextPlugin from 'extract-text-webpack-plugin'; | ||
import fs from "fs"; | ||
import path from "path"; | ||
import ExtractTextPlugin from "extract-text-webpack-plugin"; | ||
|
||
export function readFileOrEmpty(path) { | ||
try { | ||
return fs.readFileSync(path, 'utf-8'); | ||
return fs.readFileSync(path, "utf-8"); | ||
} catch (e) { | ||
return ''; | ||
return ""; | ||
} | ||
} | ||
|
||
export const defaultConfig = { | ||
entry: './index', | ||
entry: "./index", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: { loader: 'style-loader' }, | ||
fallback: { loader: "style-loader" }, | ||
use: { | ||
loader: 'css-loader', | ||
options: { minimize: true } | ||
loader: "css-loader" | ||
} | ||
}) | ||
}, | ||
], | ||
} | ||
] | ||
}, | ||
plugins: [], | ||
context: __dirname, | ||
output: { | ||
filename: 'destination.js', | ||
path: path.resolve(__dirname, '../', 'js', 'default-exports') | ||
filename: "destination.js", | ||
path: path.resolve(__dirname, "../", "js", "default-exports") | ||
} | ||
}; | ||
|
||
export function checkForWebpackErrors({err, stats, done}) { | ||
export function checkForWebpackErrors({ err, stats, done }) { | ||
if (err) return done(err); | ||
if (stats.hasErrors()) return done(new Error(stats.toString())); | ||
} |