Switch to rollupjs for css/js deps

This commit is contained in:
Christoph Reiter
2019-05-26 10:23:41 +02:00
parent 7af25bdd73
commit cb337de1f4
10 changed files with 55 additions and 23 deletions

4
.gitignore vendored
View File

@@ -1,4 +1,6 @@
*.pyc
*.files
*.db
*.json
node_modules
package-lock.json
*srcinfo.json

1
index.js Normal file
View File

@@ -0,0 +1 @@
import 'bootstrap';

19
package.json Normal file
View File

@@ -0,0 +1,19 @@
{
"devDependencies": {
"rollup": "^1.11.3",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-copy": "^2.0.1",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-terser": "^5.0.0"
},
"dependencies": {
"bootstrap": "^4.3.1",
"jquery": "^3.4.1",
"popper.js": "^1.15.0",
"rollup-plugin-uglify": "^6.0.2"
},
"scripts": {
"build": "rollup --config",
"dev": "rollup --config --watch"
}
}

26
rollup.config.js Normal file
View File

@@ -0,0 +1,26 @@
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import copy from 'rollup-plugin-copy';
import {terser} from "rollup-plugin-terser";
const dev = process.env.ROLLUP_WATCH === 'true';
export default {
input: 'index.js',
output: {
file: 'static/js/index.js',
format: 'iife'
},
plugins: [
resolve(),
commonjs(),
!dev && terser(),
copy({
targets: [
'./node_modules/bootstrap/dist/css/bootstrap.min.css',
],
outputFolder: 'static/css',
warnOnNonExist: true
}),
],
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
static/js/index.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -38,10 +38,6 @@
top: 5rem;
}
</style>
<script src="{{ url_for('static', filename='js/jquery-3.2.1.min.js') }}" ></script>
<script src="{{ url_for('static', filename='js/popper.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-light fixed-top bg-light">
@@ -69,5 +65,6 @@
</div>
{% endblock %}
<script src="{{ url_for('static', filename='js/index.js') }}" ></script>
</body>
</html>