-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgulpfile.js
81 lines (76 loc) · 2.13 KB
/
gulpfile.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const webpack = require('webpack');
const path = require('path');
const RestoreDirname = require('./webpack/restoredirname.webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
gulp.task('default', ['webpack', 'sass']);
gulp.task('sass', ['webpack'], function () {
gulp.src([
'./src/assets/css/bundle.scss',
'./src/assets/css/composer.scss',
'./src/assets/css/viewer.scss',
'./src/assets/css/preferences.scss',
'./src/assets/css/suggestions.scss'
])
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./src/assets/css/'));
});
gulp.task('webpack', function (cb) {
webpack({
target: 'electron',
context: path.join(__dirname, 'src'),
node: {
__dirname: false
},
entry: {
'index': './view/index.js',
'prompt': './view/prompt.js',
'composer': './view/composer.js',
'about': './view/about.js',
'viewer': './view/viewer.js',
'suggestions': './view/suggestions.js',
'preferences': './view/preferences.js',
'entry': './main.js'
},
output: {
path: path.join(__dirname, 'src/assets/js'),
publicPath: './js/',
filename: '[name].js',
chunkFilename: '[id].js'
},
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
}
],
noParse: /node_modules\/json-schema\/lib\/validate\.js/
},
plugins: [
new RestoreDirname(),
new ExtractTextPlugin('../css/components.scss'),
new webpack.LoaderOptionsPlugin({
options: {
vue: {
loaders: {
sass: ExtractTextPlugin.extract('css-loader!sass-loader')
}
}
}
})
],
devtool: 'source-map',
externals: { spellchecker: 'commonjs spellchecker' }
}, cb);
});
gulp.task('watch', function () {
gulp.watch('./src/static/css/**/*.scss', ['sass']);
gulp.watch(['./src/**/*.js', '!./src/entry.js', '!./src/static/js/**/*.js'], ['webpack']);
});