forked from codacy-badger/storefront
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
63 lines (57 loc) · 1.5 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
const gulp = require('gulp')
const gutil = require('gulp-util')
const webpack = require('webpack')
const path = require('path')
const i18nConvertor = require('./utils/i18nConvertor')
const gsheetsDataProvider = require('./utils/gsheetsDataProvider')
gulp.task('cjs', function (callback) {
let myConfig = {
mode: (process.env.npm_config_development) ? 'development' : 'production',
entry: {
preload: './src/cscripts/index.js'
},
output: {
path: path.join(__dirname, './public/js'),
publicPath: './public/js',
filename: 'cjs.js'
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}
}
// run webpack
webpack(myConfig, function (err, stats) {
if (err) throw new gutil.PluginError('webpack', err)
gutil.log('[webpack]', stats.toString({
colors: true,
progress: true
}))
callback()
})
})
gulp.task('public-image', function () {
return gulp.src([
'./src/assets/img/**/*.jpg',
'./src/assets/img/**/*.png',
'./src/assets/img/**/*.gif',
'./src/assets/img/**/*.svg'])
.pipe(gulp.dest('./public/img'))
})
gulp.task('locale_sync', (callback) => {
// update locales from google sheets API
gsheetsDataProvider.getLocales((rawData) => {
const jsonData = JSON.parse(rawData)
i18nConvertor.fromAllLocaleDataToFiles(jsonData)
callback()
})
})