1
|
|
|
/** |
2
|
|
|
* This file is part of the O2System Framework package. |
3
|
|
|
* |
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
5
|
|
|
* file that was distributed with this source code. |
6
|
|
|
* |
7
|
|
|
* @author Steeve Andrian Salim |
8
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
9
|
|
|
*/ |
10
|
|
|
// ------------------------------------------------------------------------ |
11
|
|
|
|
12
|
|
|
let blender = require('o2system-blender'); |
13
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin'); |
14
|
|
|
|
15
|
|
|
const path = require('path'); |
16
|
|
|
const isDev = process.env.NODE_ENV !== 'production'; |
17
|
|
|
|
18
|
|
|
blender.setOutputPath('assets/'); |
19
|
|
|
blender.setResourceRoot(''); |
20
|
|
|
|
21
|
|
|
let htmlFilename = 'index'; |
22
|
|
|
if(typeof process.env.npm_config_filename !== 'undefined') { |
23
|
|
|
htmlFilename = process.env.npm_config_filename; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
if(isDev) { |
27
|
|
|
blender.setPublicPath('./docs/'); |
28
|
|
|
|
29
|
|
|
blender.webpackConfig({ |
30
|
|
|
output: { |
31
|
|
|
path: path.resolve(__dirname, './docs/'), |
32
|
|
|
publicPath: './' |
33
|
|
|
}, |
34
|
|
|
devServer: { |
35
|
|
|
contentBase: './docs/', |
36
|
|
|
hot: true, |
37
|
|
|
open: true, |
38
|
|
|
}, |
39
|
|
|
devtool: 'source-map', |
40
|
|
|
mode: 'development', |
41
|
|
|
module: { |
42
|
|
|
rules: [ |
43
|
|
|
{ |
44
|
|
|
test: /\.(html)$/, |
45
|
|
|
include: path.join(__dirname, 'src/partials'), |
46
|
|
|
use: { |
47
|
|
|
loader: 'html-loader', |
48
|
|
|
options: { |
49
|
|
|
minimize: false, |
50
|
|
|
interpolate: true |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
] |
55
|
|
|
}, |
56
|
|
|
plugins: [ |
57
|
|
|
new HtmlWebpackPlugin({ |
58
|
|
|
title: 'O2System Venus Form UI', |
59
|
|
|
template: './src/' + htmlFilename + '.html', |
60
|
|
|
inject: 'body', |
61
|
|
|
filename: htmlFilename + '.html', |
62
|
|
|
hash: true |
63
|
|
|
}) |
64
|
|
|
] |
65
|
|
|
}); |
66
|
|
|
|
67
|
|
|
blender.js('./src/Form.js', './docs/venus-form-ui.js') |
68
|
|
|
.sass('./src/Form.scss', './docs/venus-form-ui.css') |
69
|
|
|
} else { |
70
|
|
|
blender.setPublicPath('./dist/'); |
71
|
|
|
|
72
|
|
|
blender.webpackConfig({ |
73
|
|
|
output: { |
74
|
|
|
path: path.resolve(__dirname, './dist/'), |
75
|
|
|
publicPath: './' |
76
|
|
|
}, |
77
|
|
|
mode: 'production' |
78
|
|
|
}); |
79
|
|
|
|
80
|
|
|
blender.js('./src/Form.js', './dist/venus-form-ui.js') |
81
|
|
|
.sass('./src/Form.scss', './dist/venus-form-ui.css'); |
82
|
|
|
} |