forked from getbem/getbem.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
58 lines (50 loc) · 1.89 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const fs = require('fs');
require.extensions['.md'] = function mdLoader(module, filename) {
module.exports = fs.readFileSync(filename, 'utf-8');
};
require('babel-register');
const getConfig = require('hjs-webpack');
const toHtml = require('vdom-to-html');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const app = require('./src/views/app').default;
const config = getConfig({
in: 'src/main.js',
out: 'public',
clearBeforeBuild: true,
html: function (context) {
function render(state) {
return context.defaultTemplate({
title: 'BEM — Block Element Modifier',
metaTags: {
'description': 'BEM — Block Element Modifier is a methodology, that helps you to achieve reusable components and code sharing in the front-end.',
'tags': 'BEM, HTML, CSS, JS, JavaScript, framework, front-end, frontend, web development, code sharing, components, blocks, react, webpack',
'author': 'Vsevolod Strukchinsky, Vladimir Starkov and contributors',
'twitter:card': 'summary',
'twitter:site': '@getbem',
'og:image': 'http://getbem.com/assets/bem_black.png',
'og:url': 'http://getbem.com/',
'og:title': 'BEM — Block Element Modifier',
'og: description': 'BEM — Block Element Modifier is a methodology, that helps you to achieve reusable components and code sharing in the front-end.'
},
head: [
'<link rel="icon" type="image/png" href="/assets/favicon.png"/>'
],
html: toHtml(app(state))
});
}
return {
'index.html': render({url: '/'}),
'introduction/index.html': render({url: '/introduction/'}),
'naming/index.html': render({url: '/naming/'}),
'faq/index.html': render({url: '/faq/'})
};
}
});
config.plugins.push(
new CopyWebpackPlugin([
{from: './src/assets', to: 'assets'},
{from: './src/sitemap.xml', to: '.'}
])
);
config.module.loaders.push({test: /\.md$/, loader: 'raw-loader'});
module.exports = config;