mirror of
https://github.com/tsl0922/ttyd.git
synced 2025-12-21 11:24:20 +01:00
Replace browserify with webpack
This commit is contained in:
2
html/.gitignore
vendored
2
html/.gitignore
vendored
@@ -46,4 +46,4 @@ jspm_packages
|
|||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
js/bundle.js
|
dist/
|
||||||
@@ -1,23 +1,20 @@
|
|||||||
var gulp = require('gulp'),
|
const gulp = require('gulp'),
|
||||||
fs = require("fs"),
|
inlinesource = require('gulp-inline-source'),
|
||||||
browserify = require('browserify'),
|
webpack = require('webpack-stream');
|
||||||
inlinesource = require('gulp-inline-source');
|
|
||||||
|
|
||||||
gulp.task('browserify', function () {
|
gulp.task('webpack', function() {
|
||||||
return browserify('./js/app.js')
|
return gulp.src([
|
||||||
.transform("babelify", {
|
'js/app.js',
|
||||||
presets: ["env"],
|
'sass/app.scss'
|
||||||
global: true,
|
])
|
||||||
ignore: /\/node_modules\/(?!zmodem.js\/)/
|
.pipe(webpack(require('./webpack.config.js')))
|
||||||
})
|
.pipe(gulp.dest('dist/'));
|
||||||
.bundle()
|
|
||||||
.pipe(fs.createWriteStream("./js/bundle.js"));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('inlinesource', ['browserify'], function () {
|
gulp.task('inlinesource', ['webpack'], function () {
|
||||||
return gulp.src('index.html')
|
return gulp.src('index.html')
|
||||||
.pipe(inlinesource())
|
.pipe(inlinesource())
|
||||||
.pipe(gulp.dest('../src'));
|
.pipe(gulp.dest('../src/'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['inlinesource']);
|
gulp.task('default', ['inlinesource']);
|
||||||
@@ -5,9 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<title>ttyd - Terminal</title>
|
<title>ttyd - Terminal</title>
|
||||||
<link inline rel="icon" type="image/png" href="favicon.png">
|
<link inline rel="icon" type="image/png" href="favicon.png">
|
||||||
<link inline href="node_modules/bulma/css/bulma.css">
|
<link inline href="dist/bundle.css">
|
||||||
<link inline href="node_modules/xterm/src/xterm.css">
|
|
||||||
<link inline href="css/app.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="terminal-container"></div>
|
<div id="terminal-container"></div>
|
||||||
@@ -44,6 +42,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="auth_token.js"></script>
|
<script src="auth_token.js"></script>
|
||||||
<script inline src="js/bundle.js"></script>
|
<script inline src="dist/bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
require("babel-polyfill");
|
// polyfills for ie11
|
||||||
|
require('core-js/fn/array');
|
||||||
|
require('core-js/fn/object');
|
||||||
|
require('core-js/fn/promise');
|
||||||
|
require('core-js/fn/typed');
|
||||||
require('fast-text-encoding');
|
require('fast-text-encoding');
|
||||||
|
|
||||||
var Zmodem = require('zmodem.js/src/zmodem_browser');
|
var Zmodem = require('zmodem.js/src/zmodem_browser');
|
||||||
|
|||||||
@@ -13,16 +13,23 @@
|
|||||||
"build": "gulp"
|
"build": "gulp"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-core": "^6.26.0",
|
|
||||||
"babel-polyfill": "^6.26.0",
|
|
||||||
"babel-preset-env": "^1.6.1",
|
|
||||||
"babelify": "^8.0.0",
|
|
||||||
"browserify": "^14.5.0",
|
|
||||||
"bulma": "^0.6.1",
|
"bulma": "^0.6.1",
|
||||||
|
"core-js": "^2.5.3",
|
||||||
"fast-text-encoding": "^1.0.0",
|
"fast-text-encoding": "^1.0.0",
|
||||||
"gulp": "^3.9.1",
|
|
||||||
"gulp-inline-source": "^3.0.0",
|
|
||||||
"xterm": "^3.0.1",
|
"xterm": "^3.0.1",
|
||||||
"zmodem.js": "^0.1.5"
|
"zmodem.js": "^0.1.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.26.0",
|
||||||
|
"babel-loader": "^7.1.2",
|
||||||
|
"babel-preset-env": "^1.6.1",
|
||||||
|
"css-loader": "^0.28.8",
|
||||||
|
"extract-text-webpack-plugin": "^3.0.2",
|
||||||
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-inline-source": "^3.1.0",
|
||||||
|
"node-sass": "^4.7.2",
|
||||||
|
"sass-loader": "^6.0.6",
|
||||||
|
"style-loader": "^0.19.1",
|
||||||
|
"webpack-stream": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
@import "~bulma/sass/utilities/_all";
|
||||||
|
@import "~bulma/sass/base/helpers";
|
||||||
|
@import "~bulma/sass/elements/box";
|
||||||
|
@import "~bulma/sass/elements/button";
|
||||||
|
@import "~bulma/sass/elements/form";
|
||||||
|
@import "~bulma/sass/elements/progress";
|
||||||
|
@import "~bulma/sass/components/modal";
|
||||||
|
@import "~xterm/src/xterm.css";
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
36
html/webpack.config.js
Normal file
36
html/webpack.config.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
output: {
|
||||||
|
filename: 'bundle.js'
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /node_modules\/(?!zmodem.js\/)/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
presets: ['env']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
test: /\.scss$/,
|
||||||
|
use: ExtractTextPlugin.extract({
|
||||||
|
use: [{
|
||||||
|
loader: "css-loader"
|
||||||
|
}, {
|
||||||
|
loader: "sass-loader"
|
||||||
|
}],
|
||||||
|
fallback: "style-loader"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new ExtractTextPlugin({
|
||||||
|
filename: 'bundle.css',
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
3830
html/yarn.lock
3830
html/yarn.lock
File diff suppressed because it is too large
Load Diff
9
src/index.html
vendored
9
src/index.html
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user