Skip to content

Commit ddc0e67

Browse files
committed
Preparations for extension/website merge.
1 parent 1ba57de commit ddc0e67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+31
-10
lines changed

Gruntfile.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
const websiteWebpackConfig = require('./website.webpack.config.js');
1+
const websiteWebpackConfigDev = require('./webpack.website-dev.js');
2+
const websiteWebpackConfigProd = require('./webpack.website-prod.js');
23

34
module.exports = grunt => {
45
grunt.loadNpmTasks('grunt-contrib-copy');
56
grunt.loadNpmTasks('grunt-contrib-stylus');
67
grunt.loadNpmTasks('grunt-contrib-pug');
78
grunt.loadNpmTasks('grunt-webpack');
89
grunt.loadNpmTasks('grunt-contrib-watch');
10+
grunt.loadNpmTasks('grunt-contrib-clean');
911

1012
grunt.initConfig({
13+
clean: [ 'dist' ],
1114
copy: {
1215
main: {
1316
files: [{
@@ -37,19 +40,20 @@ module.exports = grunt => {
3740
pug: {
3841
compile: {
3942
files: {
40-
'dist/website/index.html': 'views/index.pug',
41-
'dist/website/introduction/index.html': 'views/introduction.pug'
43+
'dist/website/index.html': 'views/website/index.pug',
44+
'dist/website/introduction/index.html':
45+
'views/website/introduction.pug'
4246
}
4347
}
4448
},
4549
webpack: {
46-
prod: websiteWebpackConfig,
47-
dev: websiteWebpackConfig
50+
prod: websiteWebpackConfigProd,
51+
dev: websiteWebpackConfigDev
4852
},
4953
watch: {
5054
js: {
5155
files: 'src/**',
52-
tasks: 'webpack'
56+
tasks: 'webpack:dev'
5357
},
5458
assets: {
5559
files: [
@@ -66,11 +70,14 @@ module.exports = grunt => {
6670
},
6771
views: {
6872
files: ['stylus/**', 'views/**'],
69-
tasks: ['stylus', 'pug']
73+
tasks: ['build-views']
7074
}
7175
}
7276
});
7377

74-
grunt.registerTask('build', ['copy', 'stylus', 'pug', 'webpack']);
75-
grunt.registerTask('default', ['build', 'watch']);
78+
grunt.registerTask('build-views', ['stylus', 'pug']);
79+
grunt.registerTask('build', ['clean', 'copy', 'build-views', 'webpack:prod']);
80+
grunt.registerTask('build-dev',
81+
['clean', 'copy', 'build-views', 'webpack:dev']);
82+
grunt.registerTask('default', ['build-dev', 'watch']);
7683
};

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"flipclock": "^0.7.8",
1717
"grunt": "^1.0.1",
1818
"grunt-cli": "^1.2.0",
19+
"grunt-contrib-clean": "^1.1.0",
1920
"grunt-contrib-copy": "^1.0.0",
2021
"grunt-contrib-pug": "^1.0.0",
2122
"grunt-contrib-stylus": "^1.2.0",
@@ -28,7 +29,9 @@
2829
"jstransformer-markdown-it": "^2.0.0",
2930
"pug": "^2.0.0-rc.4",
3031
"stylus": "^0.54.5",
31-
"webpack": "^3.10.0"
32+
"uglifyjs-webpack-plugin": "^1.1.6",
33+
"webpack": "^3.10.0",
34+
"webpack-merge": "^4.1.1"
3235
},
3336
"scripts": {
3437
"test": "echo UNIMPLEMENTED",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

webpack.website-prod.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const webpack = require('webpack');
2+
const merge = require('webpack-merge');
3+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
4+
5+
const devConfig = require('./webpack.website-dev.js');
6+
7+
module.exports = merge(devConfig, {
8+
plugins: [
9+
new UglifyJsPlugin()
10+
]
11+
});

0 commit comments

Comments
 (0)