Skip to content

Instantly share code, notes, and snippets.

@YoruNoHikage
Last active August 29, 2015 14:18
Show Gist options
  • Save YoruNoHikage/c4e8bdffcaf061201336 to your computer and use it in GitHub Desktop.
Save YoruNoHikage/c4e8bdffcaf061201336 to your computer and use it in GitHub Desktop.
[WIP] Webpack for Symfony
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require('webpack');
var basedir = __dirname + '/src/Namespace/AppBundle/Resources/views/assets/';
var entry = {
// index: 'index',
user: 'User/user',
game: 'Game/game',
};
for(i in entry) {
entry[i] = basedir + entry[i];
}
module.exports = {
entry: entry,
output: {
path: "./web/",
filename: "[name].bundle.js",
chunkFilename: "[id].bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" },
{ test: /\.scss/, loader: ExtractTextPlugin.extract("style", "css!sass") },
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin("commons", "commons.js", ["user", "game"]),
new ExtractTextPlugin("[name].bundle.css")
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment