updated webpack loader and lots of javscript stuff

This commit is contained in:
vabene1111 2021-04-28 09:41:06 +02:00
parent 5ee718b578
commit d06e6c0ab3
16 changed files with 1142 additions and 755 deletions

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,5 @@
window.IMPORT_ID = {{pk}};
</script>
{% render_bundle 'chunk-vendors' %}
{% render_bundle 'import_response_view' %}
{% endblock %}

View File

@ -38,8 +38,6 @@
<script src="{% static 'django_js_reverse/reverse.js' %}"></script>
{% endif %}
{% render_bundle 'chunk-vendors' %}
<!--
yes this is a stupid solution! i need to figure out a better way to do this but the version hashes
of djangos static files prevent my from simply using preCacheAndRoute

View File

@ -27,6 +27,5 @@
window.IMAGE_PLACEHOLDER = "{% static 'assets/recipe_no_image.svg' %}"
</script>
{% render_bundle 'chunk-vendors' %}
{% render_bundle 'recipe_search_view' %}
{% endblock %}

File diff suppressed because one or more lines are too long

View File

@ -15,8 +15,10 @@ import random
import string
from django.contrib import messages
from django.contrib.staticfiles.storage import staticfiles_storage
from django.utils.translation import gettext_lazy as _
from dotenv import load_dotenv
from webpack_loader.loader import WebpackLoader
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -193,6 +195,18 @@ DATABASES = {
# Vue webpack settings
VUE_DIR = os.path.join(BASE_DIR, 'vue')
class CustomWebpackLoader(WebpackLoader):
def get_chunk_url(self, chunk):
asset = self.get_assets()['assets'][chunk['name']]
return super().get_chunk_url(asset)
def filter_chunks(self, chunks):
chunks = [chunk if isinstance(chunk, dict) else {'name': chunk} for chunk in chunks]
return super().filter_chunks(chunks)
WEBPACK_LOADER = {
'DEFAULT': {
'CACHE': not DEBUG,
@ -200,7 +214,8 @@ WEBPACK_LOADER = {
'STATS_FILE': os.path.join(VUE_DIR, 'webpack-stats.json'),
'POLL_INTERVAL': 0.1,
'TIMEOUT': None,
'IGNORE': [r'.+\.hot-update.js', r'.+\.map']
'IGNORE': [r'.+\.hot-update.js', r'.+\.map'],
'LOADER_CLASS': 'recipes.settings.CustomWebpackLoader',
}
}

View File

@ -14,11 +14,13 @@
"moment": "^2.29.1",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-cookies": "^1.7.4",
"vue-i18n": "^8.24.3",
"vue-multiselect": "^2.1.6",
"vue-property-decorator": "^9.1.2",
"vue-template-compiler": "^2.6.12",
"vuex": "^3.6.0"
"vuex": "^3.6.0",
"workbox-webpack-plugin": "^6.1.5"
},
"devDependencies": {
"@kazupon/vue-i18n-loader": "^0.5.0",
@ -32,11 +34,11 @@
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint": "^7.25.0",
"eslint-plugin-vue": "^7.0.0-0",
"typescript": "~4.1.5",
"typescript": "~4.2.4",
"vue-cli-plugin-i18n": "^2.1.0",
"webpack-bundle-tracker": "0.4.3",
"webpack-bundle-tracker": "1.0.0-alpha.1",
"workbox-expiration": "^6.0.2",
"workbox-navigation-preload": "^6.0.2",
"workbox-precaching": "^6.0.2",

View File

@ -27,6 +27,7 @@
<b-collapse id="collapse_advanced_search" class="mt-2" v-model="settings.advanced_search_visible">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-3" style="margin-top: 1vh">
<a class="btn btn-primary btn-block text-uppercase"
@ -51,21 +52,18 @@
</div>
<div class="row">
<div class="col-12">
<b-input-group style="margin-top: 1vh">
<generic-multiselect @change="genericSelectChanged" parent_variable="search_keywords"
:initial_selection="search_keywords"
search_function="listKeywords" label="label"
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"
v-bind:placeholder="$t('Keywords')"></generic-multiselect>
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_keywords_or" name="check-button"
@change="refreshData"
class="shadow-none" switch>
@ -80,7 +78,6 @@
<div class="row">
<div class="col-12">
<b-input-group style="margin-top: 1vh">
<generic-multiselect @change="genericSelectChanged" parent_variable="search_foods"
:initial_selection="search_foods"
@ -98,13 +95,11 @@
</b-input-group-text>
</b-input-group-append>
</b-input-group>
</div>
</div>
<div class="row">
<div class="col-12">
<b-input-group style="margin-top: 1vh">
<generic-multiselect @change="genericSelectChanged" parent_variable="search_books"
:initial_selection="search_books"
@ -113,7 +108,6 @@
v-bind:placeholder="$t('Books')"></generic-multiselect>
<b-input-group-append>
<b-input-group-text>
<b-form-checkbox v-model="settings.search_books_or" name="check-button"
@change="refreshData"
class="shadow-none" tyle="width: 100%" switch>
@ -123,8 +117,6 @@
</b-input-group-text>
</b-input-group-append>
</b-input-group>
</div>
</div>
@ -222,6 +214,8 @@ export default {
search_foods_or: true,
search_books_or: true,
advanced_search_visible: false,
show_meal_plan: true,
recently_viewed: 5,
},
pagination_count: 0,

View File

@ -44,6 +44,7 @@
"Search": "Search",
"Import": "Import",
"Print": "Print",
"Settings": "Settings",
"or": "or",
"and": "and",
"Information": "Information"

View File

@ -78,9 +78,7 @@ module.exports = {
})
*/
config
.plugin('BundleTracker')
.use(BundleTracker, [{filename: '../vue/webpack-stats.json'}]);
config.plugin('BundleTracker').use(BundleTracker, [{relativePath: true, path: '../vue/'}]);
config.resolve.alias
.set('__STATIC__', 'static')

View File

@ -1 +1 @@
{"status":"done","chunks":{"chunk-vendors":[{"name":"css/chunk-vendors.css","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\css\\chunk-vendors.css"},{"name":"js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"import_response_view":[{"name":"js/import_response_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\import_response_view.js"}],"offline_view":[{"name":"js/offline_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\offline_view.js"}],"recipe_search_view":[{"name":"js/recipe_search_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_search_view.js"}],"recipe_view":[{"name":"js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"}]}}
{"status":"done","chunks":{"recipe_search_view":["js/chunk-vendors.js","js/recipe_search_view.js","recipe_search_view.84ec50602e1246c3fe35.hot-update.js"],"recipe_view":["js/chunk-vendors.js","js/recipe_view.js"],"offline_view":["js/chunk-vendors.js","js/offline_view.js"],"import_response_view":["js/chunk-vendors.js","js/import_response_view.js"]},"publicPath":"http://localhost:8080/","assets":{"js/chunk-vendors.js":{"name":"js/chunk-vendors.js","path":"js\\chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js"},"js/import_response_view.js":{"name":"js/import_response_view.js","path":"js\\import_response_view.js","publicPath":"http://localhost:8080/js/import_response_view.js"},"js/offline_view.js":{"name":"js/offline_view.js","path":"js\\offline_view.js","publicPath":"http://localhost:8080/js/offline_view.js"},"js/recipe_search_view.js":{"name":"js/recipe_search_view.js","path":"js\\recipe_search_view.js","publicPath":"http://localhost:8080/js/recipe_search_view.js"},"js/recipe_view.js":{"name":"js/recipe_view.js","path":"js\\recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js"},"recipe_search_view.84ec50602e1246c3fe35.hot-update.js":{"name":"recipe_search_view.84ec50602e1246c3fe35.hot-update.js","path":"recipe_search_view.84ec50602e1246c3fe35.hot-update.js","publicPath":"http://localhost:8080/recipe_search_view.84ec50602e1246c3fe35.hot-update.js"},"84ec50602e1246c3fe35.hot-update.json":{"name":"84ec50602e1246c3fe35.hot-update.json","path":"84ec50602e1246c3fe35.hot-update.json","publicPath":"http://localhost:8080/84ec50602e1246c3fe35.hot-update.json"},"recipe_search_view.html":{"name":"recipe_search_view.html","path":"recipe_search_view.html","publicPath":"http://localhost:8080/recipe_search_view.html"},"recipe_view.html":{"name":"recipe_view.html","path":"recipe_view.html","publicPath":"http://localhost:8080/recipe_view.html"},"offline_view.html":{"name":"offline_view.html","path":"offline_view.html","publicPath":"http://localhost:8080/offline_view.html"},"import_response_view.html":{"name":"import_response_view.html","path":"import_response_view.html","publicPath":"http://localhost:8080/import_response_view.html"},"manifest.json":{"name":"manifest.json","path":"manifest.json","publicPath":"http://localhost:8080/manifest.json"}}}

File diff suppressed because it is too large Load Diff