mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-25 18:02:23 +01:00
set up build script scripts to build offline bundle
This commit is contained in:
parent
d4dc1dfef4
commit
7af5780d03
5 changed files with 40 additions and 5 deletions
32
gulpfile.js
Normal file
32
gulpfile.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const gulp = require('gulp');
|
||||
const webpack = require('webpack');
|
||||
const webpackConfig = require('./webpack.config');
|
||||
const del = require('del');
|
||||
|
||||
gulp.task('clean', function () {
|
||||
del('dist')
|
||||
});
|
||||
|
||||
gulp.task('build', function () {
|
||||
webpack(webpackConfig, function (error) {
|
||||
if (error) {
|
||||
console.log('webpack failed');
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('resources', function () {
|
||||
const res = [];
|
||||
excluding('web/app', res);
|
||||
excluding('web/test', res);
|
||||
res.push('web/**/*');
|
||||
gulp.src(res).pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
function excluding(path, filter) {
|
||||
filter.push('!' + path + '/**/*', '!' + path);
|
||||
}
|
||||
|
||||
|
||||
gulp.task('default', ['clean', 'build', 'resources']);
|
||||
|
|
@ -4,7 +4,8 @@
|
|||
"description": "JS.Sketcher is a parametric 2D and 3D CAD modeler written in pure javascript",
|
||||
"scripts": {
|
||||
"start": "webpack-dev-server --content-base web/ --port 3000",
|
||||
"build": "webpack --config webpack.config.js --progress --profile --colors",
|
||||
"pack": "webpack --config webpack.config.js --progress --profile --colors",
|
||||
"build": "gulp",
|
||||
"lint": "eslint web/app -c ./build/.eslintrc.json --ignore-path ./build/.eslintignore"
|
||||
},
|
||||
"repository": {
|
||||
|
|
@ -35,7 +36,9 @@
|
|||
"eslint-plugin-import": "1.12.0",
|
||||
"style-loader": "0.13.1",
|
||||
"webpack": "1.13.2",
|
||||
"webpack-dev-server": "1.15.0"
|
||||
"webpack-dev-server": "1.15.0",
|
||||
"gulp": "3.9.1",
|
||||
"del": "2.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"sprintf": "0.1.5",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<script src="lib/csg.js"></script>
|
||||
<script src="lib/formats.js"></script>
|
||||
<script src="lib/pnltri.js"></script>
|
||||
<script src="/static/index.bundle.js"></script>
|
||||
<script src="static/index.bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="app-tab-view" id="view-3d">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<link rel="shortcut icon" href="img/tgn.png" />
|
||||
<link rel="stylesheet" href="css/toolkit.css">
|
||||
<link rel="stylesheet" href="lib/font-awesome/css/font-awesome.min.css">
|
||||
<script src="/static/sketcher.bundle.js"></script>
|
||||
<script src="static/sketcher.bundle.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a id="downloader" style="display: none;" ></a>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
sketcher: ['./web/app/sketcher']
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'dist'),
|
||||
path: path.join(__dirname, 'dist/static'),
|
||||
filename: '[name].bundle.js',
|
||||
chunkFilename: '[id].bundle.js',
|
||||
publicPath: '/static/'
|
||||
|
|
|
|||
Loading…
Reference in a new issue