Last active
May 27, 2016 09:05
-
-
Save cutalion/4fc6ada7b703c70ae05e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
path = require 'path' | |
webpack = require 'webpack' | |
exec = require 'exec-sync' | |
gemDir = (name) -> | |
exec('bundle show ' + name) | |
refileDir = path.join(gemDir('refile'), 'app/assets/javascripts') | |
jqueryRailsDir = path.join(gemDir('jquery-rails'), 'vendor/assets/javascripts') | |
SaveAssetsJson = require 'assets-webpack-plugin' | |
config = | |
context: __dirname | |
entry: | |
home: './app/assets/javascripts/home_page.js' | |
album: './app/assets/javascripts/album_page.js' | |
head: './app/assets/javascripts/head.js' | |
'admin/head': './app/assets/javascripts/admin/head.js' | |
'admin/upload': './app/assets/javascripts/admin/upload.js' | |
'admin/albums': './app/assets/javascripts/admin/albums.js' | |
output: | |
path: path.join(__dirname, 'public/assets/javascripts') | |
publicPath: '/assets/javascripts/' | |
filename: "[name]-[hash].js" | |
chunkFilename: "[id].js" | |
module: | |
loaders: [ | |
{ | |
test: /modernizr/, | |
loader: "imports?this=>window!exports?window.Modernizr" | |
} | |
{ | |
test: /\.coffee$/ | |
loader: 'coffee-loader' | |
} | |
{ | |
test: /\.scss$/, | |
loader: "style!css!sass?outputStyle=expanded" + | |
"&includePaths[]=./bower_components/foundation/scss/" + | |
"&includePaths[]=./bower_components/" + | |
"&includePaths[]=./app/assets/stylesheets/" | |
} | |
{ | |
# required to write 'require('./style.css')' | |
test: /\.css$/ | |
loader: 'style-loader!css-loader' | |
} | |
{ | |
test: /\.(gif|png|jpg|jpeg)$/ | |
loader: 'url-loader?limit=8192' | |
} | |
{ | |
test: /\.woff$/ | |
loader: 'url-loader?prefix=font/&limit=5000&minetype=application/font-woff' | |
} | |
{ | |
test: /\.ttf$/ | |
loader: 'file-loader?prefix=font/' | |
} | |
{ | |
test: /\.eot$/ | |
loader: 'file-loader?prefix=font/' | |
} | |
{ | |
test: /\.svg$/ | |
loader: 'file-loader?prefix=font/' | |
} | |
] | |
resolve: | |
alias: {} | |
extensions: ['', '.webpack.js', '.coffee', '.js', '.scss'] | |
modulesDirectories: [ | |
'app/assets', 'app/assets/javascripts', 'app/assets/stylesheets', | |
'bower_components', 'node_modules', refileDir, jqueryRailsDir | |
] | |
plugins: [ | |
new webpack.ResolverPlugin( | |
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"]) | |
), | |
new SaveAssetsJson({path: path.join(__dirname, 'public', 'assets'), filename: 'manifest.json'}) | |
] | |
module.exports = config |
This file contains hidden or 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
require('coffee-script/register'); | |
module.exports = require('./webpack.config.coffee'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment