Skip to content

Commit 3fd40f5

Browse files
committed
1.3.0 tests
1 parent 7d61e81 commit 3fd40f5

File tree

6 files changed

+74
-1
lines changed

6 files changed

+74
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/tests/dist/
12
node_modules
23
jsconfig.json

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,14 @@
2323
"duplicate",
2424
"extract-text-webpack-plugin"
2525
],
26-
"license": "MIT"
26+
"license": "MIT",
27+
"devDependencies": {
28+
"css-loader": "^0.23.1",
29+
"extract-text-webpack-plugin": "^1.0.1",
30+
"file-loader": "^0.9.0",
31+
"webpack": "^1.13.2"
32+
},
33+
"scripts": {
34+
"test": "NODE_ENV=production webpack -p --progress --profile --colors --config ./tests/webpack.config.js"
35+
}
2736
}

tests/app.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.body {
2+
background: url('./app.png') top left no-repeat;
3+
}
4+
5+
.body {
6+
color: black;
7+
}
8+
9+
.body {
10+
padding: 0;
11+
}

tests/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
require('./app.css');
2+
3+
console.log('Hello!');

tests/app.png

46.2 KB
Loading

tests/webpack.config.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
var projectPath = __dirname;
2+
var buildPath = projectPath + '/dist';
3+
4+
var Webpack = require('webpack');
5+
var ExtractTextPlugin = require('extract-text-webpack-plugin');
6+
var OptimizeCssAssetsPlugin = require('../index.js');
7+
8+
var globalVarPlugin = new Webpack.DefinePlugin({
9+
'process.env': {
10+
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
11+
},
12+
});
13+
14+
var entry = {
15+
app: './app.js',
16+
};
17+
18+
var plugins = [
19+
globalVarPlugin,
20+
new Webpack.optimize.CommonsChunkPlugin('library', 'library.js'),
21+
new Webpack.optimize.UglifyJsPlugin({
22+
compress: {
23+
warnings: false
24+
}
25+
}),
26+
new ExtractTextPlugin('[name].css', { allChunks: true }),
27+
new OptimizeCssAssetsPlugin({
28+
cssProcessorOptions: { discardComments: {removeAll: true }, zindex: false},
29+
})
30+
];
31+
32+
module.exports = {
33+
context: projectPath + '/',
34+
entry: entry,
35+
output: {
36+
filename: 'app.js',
37+
path: buildPath,
38+
},
39+
module: {
40+
loaders: [{
41+
test: /\.css$/,
42+
loader: ExtractTextPlugin.extract('css-loader?&discardDuplicates&discardComments'),
43+
},{
44+
test: /\.png$/,
45+
loader: 'file-loader'
46+
}]
47+
},
48+
plugins: plugins,
49+
};

0 commit comments

Comments
 (0)