Add webpack to be used when building vue and JS
This commit is contained in:
parent
8d704ae5c8
commit
3c47c1565f
32
gulpfile.js
32
gulpfile.js
|
@ -8,6 +8,8 @@ const postcss = require('gulp-postcss');
|
||||||
const rev = require('gulp-rev');
|
const rev = require('gulp-rev');
|
||||||
const tailwindcss = require('tailwindcss');
|
const tailwindcss = require('tailwindcss');
|
||||||
const uglify = require('gulp-uglify');
|
const uglify = require('gulp-uglify');
|
||||||
|
const webpackStream = require('webpack-stream');
|
||||||
|
const webpackConfig = require('./webpack.config.js');
|
||||||
|
|
||||||
const argv = require('yargs')
|
const argv = require('yargs')
|
||||||
.default('production', false)
|
.default('production', false)
|
||||||
|
@ -17,14 +19,11 @@ const paths = {
|
||||||
manifest: './public/assets',
|
manifest: './public/assets',
|
||||||
assets: './public/assets/{css,scripts}/*.{css,js}',
|
assets: './public/assets/{css,scripts}/*.{css,js}',
|
||||||
styles: {
|
styles: {
|
||||||
src: './resources/assets/pterodactyl/css/**/*.css',
|
src: './resources/assets/pterodactyl/styles/**/*.css',
|
||||||
dest: './public/assets/css',
|
dest: './public/assets/css',
|
||||||
},
|
},
|
||||||
scripts: {
|
scripts: {
|
||||||
src: [
|
src: './resources/assets/pterodactyl/scripts/**/*.js',
|
||||||
'./resources/assets/pterodactyl/scripts/**/*.js',
|
|
||||||
'./node_modules/jquery/dist/jquery.js',
|
|
||||||
],
|
|
||||||
dest: './public/assets/scripts',
|
dest: './public/assets/scripts',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -36,14 +35,15 @@ function styles() {
|
||||||
return gulp.src(paths.styles.src)
|
return gulp.src(paths.styles.src)
|
||||||
.pipe(postcss([
|
.pipe(postcss([
|
||||||
require('postcss-import'),
|
require('postcss-import'),
|
||||||
|
require('postcss-preset-env')({stage: 0}),
|
||||||
tailwindcss('./tailwind.js'),
|
tailwindcss('./tailwind.js'),
|
||||||
require('autoprefixer')]
|
require('autoprefixer'),
|
||||||
))
|
]))
|
||||||
.pipe(gulpif(argv.production, cssmin()))
|
.pipe(gulpif(argv.production, cssmin()))
|
||||||
.pipe(concat('bundle.css'))
|
.pipe(concat('bundle.css'))
|
||||||
.pipe(rev())
|
.pipe(rev())
|
||||||
.pipe(gulp.dest(paths.styles.dest))
|
.pipe(gulp.dest(paths.styles.dest))
|
||||||
.pipe(rev.manifest(paths.manifest + '/manifest.json', { merge: true, base: paths.manifest }))
|
.pipe(rev.manifest(paths.manifest + '/manifest.json', {merge: true, base: paths.manifest}))
|
||||||
.pipe(gulp.dest(paths.manifest));
|
.pipe(gulp.dest(paths.manifest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,22 +51,27 @@ function styles() {
|
||||||
* Build all of the waiting scripts.
|
* Build all of the waiting scripts.
|
||||||
*/
|
*/
|
||||||
function scripts() {
|
function scripts() {
|
||||||
return gulp.src(paths.scripts.src)
|
return webpackStream(webpackConfig)
|
||||||
.pipe(babel())
|
.pipe(babel())
|
||||||
.pipe(gulpif(argv.production, uglify()))
|
.pipe(gulpif(argv.production, uglify()))
|
||||||
.pipe(concat('bundle.js'))
|
.pipe(concat('bundle.js'))
|
||||||
.pipe(rev())
|
.pipe(rev())
|
||||||
.pipe(gulp.dest(paths.scripts.dest))
|
.pipe(gulp.dest(paths.scripts.dest))
|
||||||
.pipe(rev.manifest(paths.manifest + '/manifest.json', { merge: true, base: paths.manifest }))
|
.pipe(rev.manifest(paths.manifest + '/manifest.json', {merge: true, base: paths.manifest}))
|
||||||
.pipe(gulp.dest(paths.manifest));
|
.pipe(gulp.dest(paths.manifest));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proves watchers.
|
* Provides watchers.
|
||||||
*/
|
*/
|
||||||
function watch() {
|
function watch() {
|
||||||
gulp.watch(paths.styles.src, styles);
|
gulp.watch(paths.styles.src, gulp.series(function cleanStyles() {
|
||||||
gulp.watch(paths.scripts.src, scripts);
|
return del(['./public/assets/css/**/*.css']);
|
||||||
|
}, styles));
|
||||||
|
|
||||||
|
gulp.watch([paths.scripts.src, paths.vue.src], gulp.series(function cleanScripts() {
|
||||||
|
return del(['./public/assets/scripts/**/*.js']);
|
||||||
|
}, scripts));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,4 +86,5 @@ exports.styles = styles;
|
||||||
exports.scripts = scripts;
|
exports.scripts = scripts;
|
||||||
exports.watch = watch;
|
exports.watch = watch;
|
||||||
|
|
||||||
|
gulp.task('scripts', gulp.series(clean, scripts));
|
||||||
gulp.task('default', gulp.series(clean, styles, scripts));
|
gulp.task('default', gulp.series(clean, styles, scripts));
|
||||||
|
|
14
package.json
14
package.json
|
@ -2,8 +2,11 @@
|
||||||
"name": "pterodactyl-panel",
|
"name": "pterodactyl-panel",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^8.2.0",
|
"autoprefixer": "^8.2.0",
|
||||||
|
"axios": "^0.18.0",
|
||||||
"babel-cli": "6.18.0",
|
"babel-cli": "6.18.0",
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
|
"babel-loader": "^7.1.4",
|
||||||
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
"babel-plugin-transform-strict-mode": "^6.18.0",
|
"babel-plugin-transform-strict-mode": "^6.18.0",
|
||||||
"babel-preset-es2015": "^6.24.1",
|
"babel-preset-es2015": "^6.24.1",
|
||||||
"babel-register": "^6.26.0",
|
"babel-register": "^6.26.0",
|
||||||
|
@ -19,10 +22,19 @@
|
||||||
"gulp-rev": "^8.1.1",
|
"gulp-rev": "^8.1.1",
|
||||||
"gulp-uglify": "^3.0.0",
|
"gulp-uglify": "^3.0.0",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
|
"lodash": "^4.17.5",
|
||||||
"postcss": "^6.0.21",
|
"postcss": "^6.0.21",
|
||||||
"postcss-import": "^11.1.0",
|
"postcss-import": "^11.1.0",
|
||||||
|
"postcss-preset-env": "^3.4.0",
|
||||||
|
"postcss-scss": "^1.0.4",
|
||||||
"tailwindcss": "^0.5.1",
|
"tailwindcss": "^0.5.1",
|
||||||
"vue": "^2.5.16",
|
"vue": "^2.5.7",
|
||||||
|
"vue-axios": "^2.1.1",
|
||||||
|
"vue-devtools": "^3.1.9",
|
||||||
|
"vue-loader": "^14.2.2",
|
||||||
|
"vueify-insert-css": "^1.0.0",
|
||||||
|
"webpack": "^4.4.1",
|
||||||
|
"webpack-stream": "^4.0.3",
|
||||||
"yargs": "^11.0.0"
|
"yargs": "^11.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
27
tailwind.js
27
tailwind.js
|
@ -194,37 +194,25 @@ module.exports = {
|
||||||
|
|
||||||
fonts: {
|
fonts: {
|
||||||
'sans': [
|
'sans': [
|
||||||
|
'"Source Sans Pro"',
|
||||||
'system-ui',
|
'system-ui',
|
||||||
'BlinkMacSystemFont',
|
'BlinkMacSystemFont',
|
||||||
'-apple-system',
|
'-apple-system',
|
||||||
'Segoe UI',
|
'"Helvetica Neue"',
|
||||||
'Roboto',
|
|
||||||
'Oxygen',
|
|
||||||
'Ubuntu',
|
|
||||||
'Cantarell',
|
|
||||||
'Fira Sans',
|
|
||||||
'Droid Sans',
|
|
||||||
'Helvetica Neue',
|
|
||||||
'sans-serif',
|
'sans-serif',
|
||||||
],
|
],
|
||||||
'serif': [
|
'serif': [
|
||||||
'Constantia',
|
'Constantia',
|
||||||
'Lucida Bright',
|
'"Lucida Bright"',
|
||||||
'Lucidabright',
|
'Lucidabright',
|
||||||
'Lucida Serif',
|
'"Lucida Serif"',
|
||||||
'Lucida',
|
'Lucida',
|
||||||
'DejaVu Serif',
|
|
||||||
'Bitstream Vera Serif',
|
|
||||||
'Liberation Serif',
|
|
||||||
'Georgia',
|
|
||||||
'serif',
|
'serif',
|
||||||
],
|
],
|
||||||
'mono': [
|
'mono': [
|
||||||
'Menlo',
|
'Menlo',
|
||||||
'Monaco',
|
'Monaco',
|
||||||
'Consolas',
|
'Consolas',
|
||||||
'Liberation Mono',
|
|
||||||
'Courier New',
|
|
||||||
'monospace',
|
'monospace',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -419,7 +407,7 @@ module.exports = {
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
borderColors: global.Object.assign({ default: colors['grey-light'] }, colors),
|
borderColors: global.Object.assign({default: colors['grey-light']}, colors),
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -592,6 +580,7 @@ module.exports = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
maxWidth: {
|
maxWidth: {
|
||||||
|
'xxs': '10rem',
|
||||||
'xs': '20rem',
|
'xs': '20rem',
|
||||||
'sm': '30rem',
|
'sm': '30rem',
|
||||||
'md': '40rem',
|
'md': '40rem',
|
||||||
|
@ -649,6 +638,7 @@ module.exports = {
|
||||||
'4': '1rem',
|
'4': '1rem',
|
||||||
'6': '1.5rem',
|
'6': '1.5rem',
|
||||||
'8': '2rem',
|
'8': '2rem',
|
||||||
|
'10': '2.5rem',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -900,8 +890,7 @@ module.exports = {
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
require('tailwindcss/plugins/container')({
|
require('tailwindcss/plugins/container')({
|
||||||
// center: true,
|
center: true,
|
||||||
// padding: '1rem',
|
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
module.exports = {
|
||||||
|
entry: './resources/assets/pterodactyl/scripts/app.js',
|
||||||
|
output: {
|
||||||
|
filename: 'webpack.build.js',
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
postcss: [
|
||||||
|
require('postcss-import'),
|
||||||
|
require('postcss-preset-env')({stage: 0}),
|
||||||
|
require('tailwindcss')('./tailwind.js'),
|
||||||
|
require('autoprefixer'),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /(node_modules)/,
|
||||||
|
use: [{
|
||||||
|
loader: "babel-loader",
|
||||||
|
options: { presets: ['es2015'] }
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'vue': 'vue/dist/vue.js'
|
||||||
|
},
|
||||||
|
extensions: ['*', '.js', '.vue', '.json']
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
};
|
Loading…
Reference in New Issue