Skip to content

Commit 3c47c15

Browse files
committed
Add webpack to be used when building vue and JS
1 parent 8d704ae commit 3c47c15

File tree

5 files changed

+2420
-1251
lines changed

5 files changed

+2420
-1251
lines changed

gulpfile.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const postcss = require('gulp-postcss');
88
const rev = require('gulp-rev');
99
const tailwindcss = require('tailwindcss');
1010
const uglify = require('gulp-uglify');
11+
const webpackStream = require('webpack-stream');
12+
const webpackConfig = require('./webpack.config.js');
1113

1214
const argv = require('yargs')
1315
.default('production', false)
@@ -17,14 +19,11 @@ const paths = {
1719
manifest: './public/assets',
1820
assets: './public/assets/{css,scripts}/*.{css,js}',
1921
styles: {
20-
src: './resources/assets/pterodactyl/css/**/*.css',
22+
src: './resources/assets/pterodactyl/styles/**/*.css',
2123
dest: './public/assets/css',
2224
},
2325
scripts: {
24-
src: [
25-
'./resources/assets/pterodactyl/scripts/**/*.js',
26-
'./node_modules/jquery/dist/jquery.js',
27-
],
26+
src: './resources/assets/pterodactyl/scripts/**/*.js',
2827
dest: './public/assets/scripts',
2928
},
3029
};
@@ -36,37 +35,43 @@ function styles() {
3635
return gulp.src(paths.styles.src)
3736
.pipe(postcss([
3837
require('postcss-import'),
38+
require('postcss-preset-env')({stage: 0}),
3939
tailwindcss('./tailwind.js'),
40-
require('autoprefixer')]
41-
))
40+
require('autoprefixer'),
41+
]))
4242
.pipe(gulpif(argv.production, cssmin()))
4343
.pipe(concat('bundle.css'))
4444
.pipe(rev())
4545
.pipe(gulp.dest(paths.styles.dest))
46-
.pipe(rev.manifest(paths.manifest + '/manifest.json', { merge: true, base: paths.manifest }))
46+
.pipe(rev.manifest(paths.manifest + '/manifest.json', {merge: true, base: paths.manifest}))
4747
.pipe(gulp.dest(paths.manifest));
4848
}
4949

5050
/**
5151
* Build all of the waiting scripts.
5252
*/
5353
function scripts() {
54-
return gulp.src(paths.scripts.src)
54+
return webpackStream(webpackConfig)
5555
.pipe(babel())
5656
.pipe(gulpif(argv.production, uglify()))
5757
.pipe(concat('bundle.js'))
5858
.pipe(rev())
5959
.pipe(gulp.dest(paths.scripts.dest))
60-
.pipe(rev.manifest(paths.manifest + '/manifest.json', { merge: true, base: paths.manifest }))
60+
.pipe(rev.manifest(paths.manifest + '/manifest.json', {merge: true, base: paths.manifest}))
6161
.pipe(gulp.dest(paths.manifest));
6262
}
6363

6464
/**
65-
* Proves watchers.
65+
* Provides watchers.
6666
*/
6767
function watch() {
68-
gulp.watch(paths.styles.src, styles);
69-
gulp.watch(paths.scripts.src, scripts);
68+
gulp.watch(paths.styles.src, gulp.series(function cleanStyles() {
69+
return del(['./public/assets/css/**/*.css']);
70+
}, styles));
71+
72+
gulp.watch([paths.scripts.src, paths.vue.src], gulp.series(function cleanScripts() {
73+
return del(['./public/assets/scripts/**/*.js']);
74+
}, scripts));
7075
}
7176

7277
/**
@@ -81,4 +86,5 @@ exports.styles = styles;
8186
exports.scripts = scripts;
8287
exports.watch = watch;
8388

89+
gulp.task('scripts', gulp.series(clean, scripts));
8490
gulp.task('default', gulp.series(clean, styles, scripts));

package.json

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
11
{
2-
"name": "pterodactyl-panel",
3-
"devDependencies": {
4-
"autoprefixer": "^8.2.0",
5-
"babel-cli": "6.18.0",
6-
"babel-core": "^6.26.0",
7-
"babel-plugin-transform-strict-mode": "^6.18.0",
8-
"babel-preset-es2015": "^6.24.1",
9-
"babel-register": "^6.26.0",
10-
"del": "^3.0.0",
11-
"gulp": "^4.0.0",
12-
"gulp-babel": "^7.0.1",
13-
"gulp-cli": "^2.0.1",
14-
"gulp-concat": "^2.6.1",
15-
"gulp-cssmin": "^0.2.0",
16-
"gulp-if": "^2.0.2",
17-
"gulp-postcss": "^7.0.1",
18-
"gulp-rename": "^1.2.2",
19-
"gulp-rev": "^8.1.1",
20-
"gulp-uglify": "^3.0.0",
21-
"jquery": "^3.3.1",
22-
"postcss": "^6.0.21",
23-
"postcss-import": "^11.1.0",
24-
"tailwindcss": "^0.5.1",
25-
"vue": "^2.5.16",
26-
"yargs": "^11.0.0"
27-
},
28-
"scripts": {
29-
"build:filemanager": "./node_modules/babel-cli/bin/babel.js public/themes/pterodactyl/js/frontend/files/src --source-maps --out-file public/themes/pterodactyl/js/frontend/files/filemanager.min.js",
30-
"watch": "./node_modules/gulp-cli/bin/gulp.js watch",
31-
"build": "./node_modules/gulp-cli/bin/gulp.js default",
32-
"build:styles": "./node_modules/gulp-cli/bin/gulp.js styles",
33-
"build:scripts": "./node_modules/gulp-cli/bin/gulp.js scripts"
34-
},
35-
"dependencies": {}
2+
"name": "pterodactyl-panel",
3+
"devDependencies": {
4+
"autoprefixer": "^8.2.0",
5+
"axios": "^0.18.0",
6+
"babel-cli": "6.18.0",
7+
"babel-core": "^6.26.0",
8+
"babel-loader": "^7.1.4",
9+
"babel-plugin-transform-runtime": "^6.23.0",
10+
"babel-plugin-transform-strict-mode": "^6.18.0",
11+
"babel-preset-es2015": "^6.24.1",
12+
"babel-register": "^6.26.0",
13+
"del": "^3.0.0",
14+
"gulp": "^4.0.0",
15+
"gulp-babel": "^7.0.1",
16+
"gulp-cli": "^2.0.1",
17+
"gulp-concat": "^2.6.1",
18+
"gulp-cssmin": "^0.2.0",
19+
"gulp-if": "^2.0.2",
20+
"gulp-postcss": "^7.0.1",
21+
"gulp-rename": "^1.2.2",
22+
"gulp-rev": "^8.1.1",
23+
"gulp-uglify": "^3.0.0",
24+
"jquery": "^3.3.1",
25+
"lodash": "^4.17.5",
26+
"postcss": "^6.0.21",
27+
"postcss-import": "^11.1.0",
28+
"postcss-preset-env": "^3.4.0",
29+
"postcss-scss": "^1.0.4",
30+
"tailwindcss": "^0.5.1",
31+
"vue": "^2.5.7",
32+
"vue-axios": "^2.1.1",
33+
"vue-devtools": "^3.1.9",
34+
"vue-loader": "^14.2.2",
35+
"vueify-insert-css": "^1.0.0",
36+
"webpack": "^4.4.1",
37+
"webpack-stream": "^4.0.3",
38+
"yargs": "^11.0.0"
39+
},
40+
"scripts": {
41+
"build:filemanager": "./node_modules/babel-cli/bin/babel.js public/themes/pterodactyl/js/frontend/files/src --source-maps --out-file public/themes/pterodactyl/js/frontend/files/filemanager.min.js",
42+
"watch": "./node_modules/gulp-cli/bin/gulp.js watch",
43+
"build": "./node_modules/gulp-cli/bin/gulp.js default",
44+
"build:styles": "./node_modules/gulp-cli/bin/gulp.js styles",
45+
"build:scripts": "./node_modules/gulp-cli/bin/gulp.js scripts"
46+
},
47+
"dependencies": {}
3648
}

0 commit comments

Comments
 (0)