Created
May 9, 2018 21:41
-
-
Save macouella/b866e3935cecd53bdd45128f9922fe49 to your computer and use it in GitHub Desktop.
JM EXample
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
const path = require('path'); | |
const pathConfig = require('./path-config.json'); | |
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') | |
.BundleAnalyzerPlugin; | |
const opn = require('opn'); | |
module.exports = { | |
html: false, | |
ghPages: false, | |
images: true, | |
fonts: true, | |
static: true, | |
svgSprite: true, | |
stylesheets: true, | |
browserSync: { | |
port: 5605, | |
cors: true, | |
proxy: { | |
target: pathConfig.browserSync.proxyTarget, | |
proxyReq: [ | |
function(proxyReq) { | |
proxyReq.setHeader( | |
'host', | |
pathConfig.host.replace(/^https?:\/\//i, '') | |
); | |
// grabone authentication requires proper host header to be set | |
proxyReq.setHeader('Access-Control-Allow-Origin', '*'); | |
} | |
] | |
}, | |
files: pathConfig.browserSync.files.map(fileGlob => | |
path.join(process.env.PWD, fileGlob) | |
), | |
open: false, | |
online: false, | |
host: pathConfig.host | |
}, | |
javascripts: { | |
entry: { | |
min: ['old.js'], | |
index: ['app.js'], | |
api_menu: ['api/menu.js'], | |
admin: ['admin.js'] | |
}, | |
provide: { | |
$: 'jquery', | |
jQuery: 'jquery' | |
}, | |
publicPath: '/static/js', | |
loaders: [ | |
{ | |
test: /\.modernizrrc.js$/, | |
use: ['modernizr-loader'] | |
}, | |
{ | |
test: /\.modernizrrc(\.json)?$/, | |
use: ['modernizr-loader', 'json-loader'] | |
} | |
], | |
customizeWebpackConfig: (webpackConfig, env, webpack) => { | |
if (!webpackConfig.resolve.alias) webpackConfig.resolve.alias = {}; | |
webpackConfig.resolve.alias.modernizr$ = path.resolve( | |
__dirname, | |
'..', | |
'.modernizrrc' | |
); | |
return webpackConfig; | |
}, | |
development: { | |
plugins: webpack => { | |
return [new BundleAnalyzerPlugin()]; | |
} | |
} | |
}, | |
additionalTasks: { | |
initialize(gulp, PATH_CONFIG, TASK_CONFIG) { | |
gulp.task('openBrowser', function() { | |
console.log(PATH_CONFIG); | |
setTimeout(function() { | |
opn(PATH_CONFIG.host); | |
}, 1000); | |
}); | |
}, | |
development: { | |
postbuild: ['openBrowser'] | |
} | |
}, | |
production: { | |
rev: false | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment