Switch to minifier

This commit is contained in:
Ludovic Stephan 2020-09-19 12:10:03 +02:00
parent e42349bc74
commit 30ac7817cf
10 changed files with 4119 additions and 14 deletions

View file

@ -1,3 +0,0 @@
import AccountManager from "./kpsul/managers/account_manager.js"
self.account_manager = new AccountManager();

1
kfet/static/kfet/js/kpsul.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,25 @@
# Compilation des fichiers .js de K-Psul en une version minifiée
LIBS = libs/underscore.js libs/backbone.js
MODELS = $(wildcard models/**.js)
MANAGERS = $(wildcard managers/**.js)
ENTRYPOINT = kpsul.js
CONCAT_FILE = kpsul.src.js
TARGET = ../../js/kpsul.min.js
FLAGS =
build: concat minify
# For dev use : we don't minify
dev: concat cp
concat:
@cat $(LIBS) $(MODELS) $(MANAGERS) $(ENTRYPOINT) > $(CONCAT_FILE)
cp:
@cp $(CONCAT_FILE) $(TARGET)
minify:
terser $(CONCAT_FILE) -o $(TARGET) $(FLAGS)

View file

@ -0,0 +1,3 @@
$(function () {
self.account_manager = new AccountManager();
})

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,3 @@
import Account from "../models/account.js"
class AccountManager { class AccountManager {
// Classe pour gérer la partie "compte" de K-Psul // Classe pour gérer la partie "compte" de K-Psul
// Devrait être la seule interface entre le JS de K-Psul et la logique des comptes. // Devrait être la seule interface entre le JS de K-Psul et la logique des comptes.
@ -143,7 +141,7 @@ class AccountSearch {
var choice_text = choice.text().trim(); var choice_text = choice.text().trim();
var trigramme_regex = /\((.{3})\)$/; var trigramme_regex = /\((.{3})\)$/;
// le match est de la forme [<global match>, <group match>] // le match est de la forme [<global match>, <group match>]
trigramme = choice_text.match(trigramme_regex)[1] var trigramme = choice_text.match(trigramme_regex)[1]
this.manager.set(trigramme); this.manager.set(trigramme);
this.close(); this.close();
} }
@ -154,5 +152,3 @@ class AccountSearch {
} }
} }
} }
export default AccountManager;

View file

@ -144,5 +144,3 @@ var EmptyAccountView = AccountView.extend({
return buttons return buttons
} }
}) })
export default Account;

View file

@ -7,9 +7,7 @@
<script type="text/javascript" src="{% static 'kfet/vendor/moment/moment-timezone-with-data-2012-2022.min.js' %}"></script> <script type="text/javascript" src="{% static 'kfet/vendor/moment/moment-timezone-with-data-2012-2022.min.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script> <script type="text/javascript" src="{% static 'kfet/js/history.js' %}"></script>
<script type="text/javascript" src="{% url 'js_reverse' %}" ></script> <script type="text/javascript" src="{% url 'js_reverse' %}" ></script>
<script type="text/javascript" src="{% static 'kfet/vendor/underscore-min.js' %}"></script> <script type="text/javascript" src="{% static 'kfet/js/kpsul.min.js' %}"></script>
<script type="text/javascript" src="{% static 'kfet/vendor/backbone-min.js' %}"></script>
<script type="module" src="{% static 'kfet/js/kpsul.js' %}"></script>
{% endblock %} {% endblock %}
{% block title %}K-Psul{% endblock %} {% block title %}K-Psul{% endblock %}