Skip to content
Snippets Groups Projects
Commit 7b6db640e886 authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Split all js and screen css into main and map

parent fc0d40e4f0bb
No related branches found
No related tags found
No related merge requests found
......@@ -11,9 +11,9 @@
var touch = require('gulp-touch-fd');
var fontName = 'Icons';
gulp.task('js', function() {
gulp.task('main-js', function() {
return gulp.src([
'node_modules/jquery/dist/jquery.slim.js',
'node_modules/popper.js/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'node_modules/wowjs/dist/wow.js',
......@@ -15,9 +15,8 @@
return gulp.src([
'node_modules/jquery/dist/jquery.slim.js',
'node_modules/popper.js/dist/umd/popper.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'node_modules/wowjs/dist/wow.js',
'node_modules/leaflet/dist/leaflet.js',
'node_modules/loading-attribute-polyfill/loading-attribute-polyfill.js',
'js/wow.js',
'js/highlight.pack.js',
......@@ -21,7 +20,19 @@
'node_modules/loading-attribute-polyfill/loading-attribute-polyfill.js',
'js/wow.js',
'js/highlight.pack.js',
'js/highlight.js',
'js/highlight.js'])
.pipe(sourcemaps.init())
.pipe(gulp.dest('static/js/'))
.pipe(concat('main.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('static/js/'))
.pipe(touch());
});
gulp.task('map-js', function() {
return gulp.src([
'node_modules/leaflet/dist/leaflet.js',
'js/map.js'])
.pipe(sourcemaps.init())
.pipe(gulp.dest('static/js/'))
......@@ -25,7 +36,7 @@
'js/map.js'])
.pipe(sourcemaps.init())
.pipe(gulp.dest('static/js/'))
.pipe(concat('all.js'))
.pipe(concat('map.js'))
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('static/js/'))
......@@ -64,6 +75,7 @@
});
gulp.task('css', gulp.series(['iconfont', 'sass']));
gulp.task('js', gulp.parallel(['main-js', 'map-js']));
gulp.task('watch', function() {
gulp.watch(['sass/**/*.scss'], gulp.parallel(['sass']));
......
$(document).ready(function() {
document.addEventListener('DOMContentLoaded', function() {
if (typeof setupMap !== 'undefined') {
setupMap();
}
......
......@@ -11,5 +11,4 @@
@import 'header/header';
@import 'footer/footer';
@import 'highlight/default';
@import '~leaflet/dist/leaflet';
@import 'iconfont/iconfont';
@import '~leaflet/dist/leaflet';
......@@ -39,6 +39,6 @@
{%- endif %}
{% block style %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/screen.css') }}"/>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}"/>
{% endblock style %}
......@@ -43,6 +43,6 @@
{% endblock style %}
<script async src="{{ url_for('static', filename='js/all.js') }}"></script>
<script async src="{{ url_for('static', filename='js/main.js') }}"></script>
{% endblock head %}
</head>
<body>
......
......@@ -41,4 +41,9 @@
</div>
{% endblock content %}
{% block style %}
{{ super() }}
<link rel="stylesheet" href="{{ url_for('static', filename='css/map.css') }}"/>
{% endblock style %}
{% block script %}
......@@ -44,4 +49,5 @@
{% block script %}
<script async src="{{ url_for('static', filename='js/map.js') }}"></script>
<script>
function setupMap() {
L.Icon.Default.imagePath = '/static/images/';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment