Skip to content

Instantly share code, notes, and snippets.

@magsout
Last active August 29, 2015 14:21
Show Gist options
  • Save magsout/4b77d119f1465a87d7c6 to your computer and use it in GitHub Desktop.
Save magsout/4b77d119f1465a87d7c6 to your computer and use it in GitHub Desktop.
Simple webpack config
// webpack.config.js
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var path = require("path");
module.exports = {
// The standard entry point and output config
entry: {
app: "./app"
},
output: {
filename: "[name].js",
path: path.join(__dirname, "./css"),
publicPath: "/",
},
resolve: {
extensions: [
"",
".js",
".css"
],
},
cssnext: {
url: false,
browsers : ['ff >= 20', 'ie >= 8', 'safari >= 5.1', 'opera >= 12', 'chrome >=20'],
import: {
path: ["./front.css"]
}
},
module: {
loaders: [
// Extract css files
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
"style-loader", "css-loader!cssnext-loader"
)
},
{ test: /\.png$/, loader: "file-loader" }
]
},
// Use the plugin to specify the resulting filename (and add needed behavior to the compiler)
plugins: [
new ExtractTextPlugin("front.css")
]
}
@nickdima
Copy link

Do you use @import in your cssnext files? If so you are ending up with duplicate code in the final bundle most definitely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment