joyent-portal/frontend/webpack/base.js
Sérgio Ramos 5e21ff1e64 add icons to ui (#347)
fixes #282
fixes #297
fixes #333

Not only adds icons (as svgs) but also removes the assets folder which adds some
side effects:
 - move fonts to it's own component (currently only exposing libre-franlin)
 - Base.global requires fonts and injects them
 - update webpack and babelrc to ignore/include that new folder

Having to deal with those side effects, I took the opportunity to add some
improvements:
 - rename "regular" to "normal" which conforms to the font-weight rule options
 - apply family and weight to buttons (which default to system-ui)
 - replace all font-weight to use the typography composer
 - only use "Libra Franklin" as the family name, using weight to vary between
 files
2017-03-03 15:29:03 +00:00

82 lines
1.6 KiB
JavaScript

const path = require('path');
const fs = require('fs');
const plugins = require('./plugins');
const paths = require('./paths');
const {
ROOT,
MODULES,
FRONTEND,
UI,
STATIC
} = paths;
module.exports = {
context: ROOT,
entry: `./${path.relative(ROOT, path.join(FRONTEND, 'index.js'))}`,
resolve: {
modules: MODULES,
alias: fs.readdirSync(FRONTEND)
.map((name) => path.join(FRONTEND, name))
.filter((fullpath) => fs.statSync(fullpath).isDirectory())
.reduce((aliases, fullpath) => Object.assign(aliases, {
[`@${path.basename(fullpath)}`]: fullpath
}), {
'@root': FRONTEND,
'@ui': UI
})
},
resolveLoader: {
modules: MODULES
},
output: {
pathinfo: true,
path: STATIC,
publicPath: '/static/',
filename: '[name].js'
},
plugins: [
plugins['define'](),
plugins['shell'](),
plugins['named-modules'](),
plugins['case-sensitive-paths']()
],
module: {
rules: [{
loader: 'url-loader',
exclude: [
/\.html$/,
/\.(js|jsx)$/,
/\.css$/,
/\.json$/,
/\.svg$/,
/\.(eot|svg|ttf|woff|woff2)$/
],
include: [
FRONTEND,
UI
],
options: {
limit: 10000
}
}, {
test: /js?$/,
loader: 'babel-loader',
exclude: /node_modules/,
include: [
FRONTEND,
UI
]
}, {
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
include: path.join(UI, 'components', 'fonts', 'libre-franklin')
}, {
test: /\.css$/,
loader: 'style-loader!css-loader'
}]
}
};